1. 程式人生 > 實用技巧 >交換機trunk的配置

交換機trunk的配置

這個實驗也是有關vlan的,有2臺交換機,這樣的網路拓撲我的理解在一定程度上可以起到雙機熱備的作用. 因模擬軟體無法實現VTP的功能,只能每臺配置vlan 實驗目的: pc1--pc4互通 pc2--pc3互通 sw1:
Switch>en
Switch#conf t
Enter configuration commands, .e per line. End with CNTL/Z.
Switch(config)#host sw1
sw1(config)#end
sw1#vlan data
sw1(vlan)#vlan 10 name vlan10
VLAN 10 added:
Name:vlan10
sw1(vlan)#vlan 20 name vlan20
VLAN 20 added:
Name:vlan20
sw1(vlan)#end sw1#conf t
Enter configuration commands, .e per line. End with CNTL/Z.
sw1(config)#int f0/1
sw1(config-if)#switchport access vlan 20
sw1(config-if)#int f0/2
sw1(config-if)#switchport access vlan 10
sw1(config)#int f0/12
sw1(config-if)#switchport mode trunk
sw1(config-if)#switchport trunk encapsulation dot1q
sw1(config-if)#end
sw1# sw2:
Switch>en
Switch#conf t
Enter configuration commands, .e per line. End with CNTL/Z.
Switch(config)#host sw2
sw2(config)#end
sw2#vlan data
sw2(vlan)#vlan 10 name vlan10
sw2(vlan)#vlan 20 name vlan20
VLAN 20 added:
Name:vlan20
sw2(vlan)#end
sw2#sh vlan VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14
10 vlan10 active 20 vlan20 active
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1 enet 100001 1500 - - - - - 0 0
10 enet 100010 1500 - - - - - 0 0
20 enet 100020 1500 - - - - - 0 0
1002 fddi 101002 1500 - - - - - 0 0
1003 tr 101003 1500 - - - - - 0 0
1004 fdnet 101004 1500 - - - ieee - 0 0 sw2#conf t
Enter configuration commands, .e per line. End with CNTL/Z.
sw2(config)#int f0/1
sw2(config-if)#switchport access vlan 10
sw2(config-if)#int f0/2
sw2(config-if)#switchport access vlan 20
sw2(config-if)#int f0/12
sw2(config-if)#switchport mode trunk
sw2(config-if)#switchport trunk encapsulation dot1q
sw2(config-if)# 配置完成!