1. 程式人生 > >cisco之VLAN的配置

cisco之VLAN的配置

cisco trunk

一 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的配置