配置SW1的交换机
SW1#vlan database
SW1(vlan)#vlan 2
VLAN 2 modified:
SW1(vlan)#vlan 3
VLAN 3 modified:
SW1(vlan)#exit
APPLY completed.
Exiting....
SW1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW1(config)#int f0/0
SW1(config-if)#switchport mode trunk
SW1(config-if)#exit
SW1(config)#ip routing
SW1(config)#int vlan 2
SW1(config-if)#ip address 1
SW1(config-if)#ip address 192.168.10.1 255.255.255.0
SW1(config-if)#no sh
SW1(config-if)#int vlan 3
SW1(config-if)#ip address 192.168.20.1 255.255.255.0
SW1(config-if)#no sh
SW1(config-if)#do sh vlan-s
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, Fa0/15
2 VLAN0002 active
3 VLAN0003 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 - - - - - 1002 1003
2 enet 100002 1500 - - - - - 0 0
3 enet 100003 1500 - - - - - 0 0
1002 fddi 101002 1500 - - - - - 1 1003
1003 tr 101003 1500 1005 0 - - srb 1 1002
1004 fdnet 101004 1500 - - 1 ibm - 0 0
1005 trnet 101005 1500 - - 1 ibm - 0 0
SW1(config-if)#do sh ip int br
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset up up
FastEthernet0/1 unassigned YES unset up down
FastEthernet0/2 unassigned YES unset up down
FastEthernet0/3 unassigned YES unset up down
FastEthernet0/4 unassigned YES unset up down
FastEthernet0/5 unassigned YES unset up down
FastEthernet0/6 unassigned YES unset up down
FastEthernet0/7 unassigned YES unset up down
FastEthernet0/8 unassigned YES unset up down
FastEthernet0/9 unassigned YES unset up down
FastEthernet0/10 unassigned YES unset up down
FastEthernet0/11 unassigned YES unset up down
FastEthernet0/12 unassigned YES unset up down
FastEthernet0/13 unassigned YES unset up down
FastEthernet0/14 unassigned YES unset up down
FastEthernet0/15 unassigned YES unset up down
Vlan1 unassigned YES unset up up
Vlan2 192.168.10.1 YES manual up up
Vlan3 192.168.20.1 YES manual up up
SW1(config-if)#
配置SW2的交换机
SW2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW2(config)#interface f1/0
SW2(config-if)#switchport mode trunk
SW2(config-if)#int range f1/1 -2
SW2(config-if-range)#no sh
SW2(config-if-range)#exit
SW2(config)#interface f1/1
SW2(config-if)#switchport access vlan 2
SW2(config-if)#int f1/2
SW2(config-if)#switchport access vlan 3
SW2(config-if)#
SW2#sh vlan-s
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa1/3, Fa1/4, Fa1/5, Fa1/6
Fa1/7, Fa1/8, Fa1/9, Fa1/10
Fa1/11, Fa1/12, Fa1/13, Fa1/14
Fa1/15
2 VLAN0002 active Fa1/1
3 VLAN0003 active Fa1/2
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 - - - - - 1002 1003
2 enet 100002 1500 - - - - - 0 0
3 enet 100003 1500 - - - - - 0 0
1002 fddi 101002 1500 - - - - - 1 1003
1003 tr 101003 1500 1005 0 - - srb 1 1002
1004 fdnet 101004 1500 - - 1 ibm - 0 0
1005 trnet 101005 1500 - - 1 ibm - 0 0
用PC2机ping下PC1
C:\\Documents and Settings\\Administrator>ipconfig
Windows IP Configuration
Ethernet adapter 本地连接:
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 192.168.20.2
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.20.1
C:\\Documents and Settings\\Administrator>ping 192.168.10.2
Pinging 192.168.10.2 with 32 bytes of data:
Reply from 192.168.10.2: bytes=32 time=25ms TTL=127
Reply from 192.168.10.2: bytes=32 time=31ms TTL=127
Reply from 192.168.10.2: bytes=32 time=31ms TTL=127
Reply from 192.168.10.2: bytes=32 time=31ms TTL=127
Ping statistics for 192.168.10.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 25ms, Maximum = 31ms, Average = 29ms
用PC1ping下PC2
C:\\Documents and Settings\\Administrator>ipconfig
Windows IP Configuration
Ethernet adapter 本地连接:
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 192.168.20.2
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.20.1
C:\\Documents and Settings\\Administrator>ping 192.168.10.2
Pinging 192.168.10.2 with 32 bytes of data:
Reply from 192.168.10.2: bytes=32 time=25ms TTL=127
Reply from 192.168.10.2: bytes=32 time=31ms TTL=127
Reply from 192.168.10.2: bytes=32 time=31ms TTL=127
Reply from 192.168.10.2: bytes=32 time=31ms TTL=127
Ping statistics for 192.168.10.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 25ms, Maximum = 31ms, Average = 29ms
不管是把SW1的F0/0还是SW2的F1/0 down掉都会ping不通对方的PC机。
本文出自 “DY” 博客,请务必保留此出处http://guochenyong.blog.51cto.com/11367898/1975030