vlan基本命令配置 trunk鏈路配置
阿新 • • 發佈:2019-04-27
div vip 6.2 png group fas trunk模式 vlan配置 vlan通信
1 案例1:vlan基本命令
1.1 問題
1)在交換機上創建vlan10,修改名稱為web並查看vlan配置
2)刪除vlan10,查看vlan配置
3)創建vlan20,將端口f0/1加入此vlan,查看vlan配置
4)將f0/1從vlan20中刪除,查看vlan配置
1.2 步驟
實現此案例需要按照如下步驟進行
步驟一:在交換機上創建vlan10,修改名稱為web並查看vlan配置
- Switch>enable
- Switch#configure terminal
- Switch(config)#vlan 10
- Switch(config-vlan)#name web
- Switch(config-vlan)#end
- Switch#show vlan brief
步驟二:刪除vlan10,查看vlan配置
- Switch#configure terminal
- Switch(config)#no vlan 10
- Switch(config)#end
- Switch#show vlan brief
步驟三:創建vlan20,將f0/1端口加入此vlan,查看vlan配置
- Switch#configure terminal
- Switch(config)#vlan 20
- Switch(config-vlan)#exit
- Switch(config)#interface fastethernet 0/1
- Switch(config-if)#switchport access vlan 20
- Switch(config)#end
- Switch#show vlan brief
步驟四:將f0/1端口從vlan20中刪除,查看vlan配置
- Switch#configure terminal
- Switch(config)#interface fastethernet 0/1
- Switch(config-if)#no switchport access vlan 20
- Switch(config)#end
- Switch#show vlan brief
2 2 案例2:vlan基本配置
2.1 問題
在交換機上創建以下vlan,按照拓撲圖-1將端口加入到指定的vlan並配置服務器IP地址,實現通vlan主機的通信
圖-1
2.2 步驟
- Switch>enable
- Switch#configure terminal
- Switch(config)#vlan 2
- Switch(config-vlan)#vlan 3
- Switch(config-vlan)#exit
- Switch(config)#interface range fastEthernet 0/3-4
- Switch(config-if-range)#switchport access vlan 2
- Switch(config-vlan)#exit
- Switch(config)#interface range fastEthernet 0/5-6
- Switch(config-if-range)#switchport access vlan 3
- Switch#show vlan brief
3 3 案例3:跨交換機同vlan通信
3.1 問題
通過配置交換機實現圖-2中的vlan主機互通
圖-2
3.2 步驟
S1配置
- Switch#configure terminal
- Switch(config)#interface fastethernet 0/7
- Switch(config-if)#switchport access vlan 3
S2配置
- Switch>enable
- Switch#configure terminal
- Switch(config)#vlan 3
- Switch(config-vlan)#exit
- Switch(config)#interface range fastEthernet 0/5-7
- Switch(config-if-range)#switchport access vlan 3
4 4 案例4:trunk鏈路配置
4.1 問題
如圖-3所示
1)配置s1的f0/1端口為trunk模式,分別查看兩臺交換機f0/1端口的狀態
2)恢復s1的f0/1端口為默認模式,分別查看兩臺交換機f0/1端口的狀態
圖-3
4.2 步驟
配置s1的f0/1口為trunk模式,分別查看兩臺交換機f0/1端口狀態
- Switch>enable
- Switch#configure terminal
- Switch(config)#interface fastEthernet 0/1
- Switch(config-if)#switchport mode trunk
- Switch(config-if)#end
- Switch#show interfaces fastEthernet 0/1 switchport
恢復s1的f0/1口為默認模式,分別查看兩臺交換機f0/1端口狀態
- Switch#configure terminal
- Switch(config)#interface fastEthernet 0/1
- Switch(config-if)#no switchport mode trunk
- Switch#show interfaces fastEthernet 0/1 switchport
5 5 案例5:多vlan跨交換機通信
5.1 問題
通過配置實現跨交換機的同vlan通信,如圖-4所示
圖-4
5.2 步驟
註:以下配置需要在練習3的基礎上完成
S1配置
- Switch>enable
- Switch#configure terminal
- Switch(config)#interface fastEthernet 0/7
- Switch(config-if)#switchport mode trunk
S2配置
- Switch>enable
- Switch#configure terminal
- Switch(config)#vlan 2
- Switch(config-vlan)#exit
- Switch(config)#interface range fastEthernet 0/3-4
- Switch(config-if-range)#switchport access vlan 2
- Switch(config-if-range)#exit
- Switch(config)#interface fastEthernet 0/7
- Switch(config-if)#switchport mode trunk
6 6 案例6:以太網通道
6.1 問題
參照圖-5將交換機的f0/7-f0/9端口配置為以太網通道
圖-5
6.2 步驟
S1配置
- Switch>enable
- Switch#configure terminal
- Switch(config)#interface range fastEthernet 0/7-9
- Switch(config-if-range)#channel-group 1 mode on
- Switch(config-if-range)#end
- Switch#show etherchannel summary
S2配置
- Switch>enable
- Switch#configure terminal
- Switch(config)#interface range fastEthernet 0/7-9
- Switch(config-if-range)#channel-group 1 mode on
- Switch(config-if-range)#end
- Switch#show etherchannel summary
vlan基本命令配置 trunk鏈路配置