首页 > 代码库 > cisco之VLAN的配置

cisco之VLAN的配置

一 VLAN(虚拟局域网)配置

创建VLAN:

J2(config)#vlan 100

J2(config-vlan)#name vlan100

J2(config-vlan)#vlan 99

J2(config-vlan)#name vlan99


查看VLAN:

J2#sh vlan-switch 


删除VLAN:

J2(config)#no vlan 99


把端口加入vlan:

J2(config)#int range f1/1 - 12

J2(config-if-range)#switchport mode access 

J2(config-if-range)#switchport access vlan 100


查看某个具体vlan

J2#show vlan-switch id 100


VLAN Name                             Status    Ports

---- -------------------------------- --------- -------------------------------

100  vlan100                          active    Fa1/1, Fa1/2, Fa1/3, Fa1/4

                                                Fa1/5, Fa1/6, Fa1/7, Fa1/8

                                                Fa1/9, Fa1/10, Fa1/11, Fa1/12


VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2


二 Trunk:在交换网络中,链路有两种类型,接入链路(通常属于一个VLAN,如主机和交换机之间的链路)和中继链路(Trunk:可以承载多个VLAN,实现相同VLAN跨交换机通信)

1 进入接口模式,并选择封装类型:

J2(config)#int range f1/1 , f1/3

J2(config-if-range)#switchport trunk encapsulation dot1q 


2 将端口配置为Trunk

J2(config-if-range)#switchport mode trunk 


在Trunk上添加VLAN:

J2(config-if-range)#switchport trunk allowed vlan add 50

J2(config-if-range)#switchport trunk allowed vlan add 60


在Trunk上移除VLAN:

J2(config-if-range)#switchport trunk allowed vlan remove 50


查看接口模式:

J2#sh int f1/1 switchport 

Name: Fa1/1

Switchport: Enabled

Administrative Mode: trunk

Operational Mode: trunk

Administrative Trunking Encapsulation: dot1q

Operational Trunking Encapsulation: dot1q

Negotiation of Trunking: Disabled

Access Mode VLAN: 0 ((Inactive))

Trunking Native Mode VLAN: 1 (default)

Trunking VLANs Enabled: 1-49,51-1005

Trunking VLANs Active: 1,60,100

Priority for untagged frames: 0

Override vlan tag priority: FALSE

Voice VLAN: none 

Appliance trust: none


验证接口的Trunk配置:

J2#show int f1/1 trunk 


Port      Mode         Encapsulation  Status        Native vlan

Fa1/1     on           802.1q         trunking      1


Port      Vlans allowed on trunk

Fa1/1     1-49,51-1005


Port      Vlans allowed and active in management domain

Fa1/1     1,60,100


Port      Vlans in spanning tree forwarding state and not pruned

Fa1/1     1,60,100


三 以太网通道配置:

前提:

  • 参与捆绑的端口同属一个VLAN,或把它们全部配置为中继端口

  • 所有参与捆绑的端口物理参数应该相同,如相同的速率和双工模式

配置:

J2(config)#int range f1/3 - 4

J2(config-if-range)#channel-group 1 mode on

J2#sh etherchannel 1 summary 

Flags:  D - down        P - in port-channel

        I - stand-alone s - suspended

        R - Layer3      S - Layer2

        U - in use

Group Port-channel  Ports

-----+------------+-----------------------------------------------------------

1     Po1(SD)     Fa1/3(D)   Fa1/4(D)   


本文出自 “一万年太久,只争朝夕” 博客,请务必保留此出处http://zengwj1949.blog.51cto.com/10747365/1922218

cisco之VLAN的配置