1. 程式人生 > >vlan基本命令配置 trunk鏈路配置

vlan基本命令配置 trunk鏈路配置

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

  1. Switch>enable
  2. Switch#configure terminal
  3. Switch(config)#vlan 10
  4. Switch(config-vlan)#name web
  5. Switch(config-vlan)#end
  6. Switch#show vlan brief

步驟二:刪除vlan10,查看vlan配置

  1. Switch#configure terminal
  2. Switch(config)#no vlan 10
  3. Switch(config)#end
  4. Switch#show vlan brief

步驟三:創建vlan20,將f0/1端口加入此vlan,查看vlan配置

  1. Switch#configure terminal
  2. Switch(config)#vlan 20
  3. Switch(config-vlan)#exit
  4. Switch(config)#interface fastethernet 0/1
  5. Switch(config-if)#switchport access vlan 20
  6. Switch(config)#end
  7. Switch#show vlan brief

步驟四:將f0/1端口從vlan20中刪除,查看vlan配置

  1. Switch#configure terminal
  2. Switch(config)#interface fastethernet 0/1
  3. Switch(config-if)#no switchport access vlan 20
  4. Switch(config)#end
  5. Switch#show vlan brief

2 2 案例2:vlan基本配置

2.1 問題

在交換機上創建以下vlan,按照拓撲圖-1將端口加入到指定的vlan並配置服務器IP地址,實現通vlan主機的通信

技術分享圖片

圖-1

2.2 步驟

  1. Switch>enable
  2. Switch#configure terminal
  3. Switch(config)#vlan 2
  4. Switch(config-vlan)#vlan 3
  5. Switch(config-vlan)#exit
  6. Switch(config)#interface range fastEthernet 0/3-4
  7. Switch(config-if-range)#switchport access vlan 2
  8. Switch(config-vlan)#exit
  9. Switch(config)#interface range fastEthernet 0/5-6
  10. Switch(config-if-range)#switchport access vlan 3
  11. Switch#show vlan brief

3 3 案例3:跨交換機同vlan通信

3.1 問題

通過配置交換機實現圖-2中的vlan主機互通

技術分享圖片

圖-2

3.2 步驟

S1配置

  1. Switch#configure terminal
  2. Switch(config)#interface fastethernet 0/7
  3. Switch(config-if)#switchport access vlan 3

S2配置

  1. Switch>enable
  2. Switch#configure terminal
  3. Switch(config)#vlan 3
  4. Switch(config-vlan)#exit
  5. Switch(config)#interface range fastEthernet 0/5-7
  6. 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端口狀態

  1. Switch>enable
  2. Switch#configure terminal
  3. Switch(config)#interface fastEthernet 0/1
  4. Switch(config-if)#switchport mode trunk
  5. Switch(config-if)#end
  6. Switch#show interfaces fastEthernet 0/1 switchport

恢復s1的f0/1口為默認模式,分別查看兩臺交換機f0/1端口狀態

  1. Switch#configure terminal
  2. Switch(config)#interface fastEthernet 0/1
  3. Switch(config-if)#no switchport mode trunk
  4. Switch#show interfaces fastEthernet 0/1 switchport

5 5 案例5:多vlan跨交換機通信

5.1 問題

通過配置實現跨交換機的同vlan通信,如圖-4所示

技術分享圖片

圖-4

5.2 步驟

註:以下配置需要在練習3的基礎上完成

S1配置

  1. Switch>enable
  2. Switch#configure terminal
  3. Switch(config)#interface fastEthernet 0/7
  4. Switch(config-if)#switchport mode trunk

S2配置

  1. Switch>enable
  2. Switch#configure terminal
  3. Switch(config)#vlan 2
  4. Switch(config-vlan)#exit
  5. Switch(config)#interface range fastEthernet 0/3-4
  6. Switch(config-if-range)#switchport access vlan 2
  7. Switch(config-if-range)#exit
  8. Switch(config)#interface fastEthernet 0/7
  9. Switch(config-if)#switchport mode trunk

6 6 案例6:以太網通道

6.1 問題

參照圖-5將交換機的f0/7-f0/9端口配置為以太網通道

技術分享圖片

圖-5

6.2 步驟

S1配置

  1. Switch>enable
  2. Switch#configure terminal
  3. Switch(config)#interface range fastEthernet 0/7-9
  4. Switch(config-if-range)#channel-group 1 mode on
  5. Switch(config-if-range)#end
  6. Switch#show etherchannel summary

S2配置

  1. Switch>enable
  2. Switch#configure terminal
  3. Switch(config)#interface range fastEthernet 0/7-9
  4. Switch(config-if-range)#channel-group 1 mode on
  5. Switch(config-if-range)#end
  6. Switch#show etherchannel summary

vlan基本命令配置 trunk鏈路配置