拓扑
交换机之间互联都是trunk,pc1 vlan10,pc2 vlan20;
R5表示外部接入,R5,SW1,SW2走EIGRP协议
默认正常情况下,pc1流量走sw1,pc2 流量走sw2
接口配置
PC1
pc1(config)#int e0/0
pc1(config-if)#no sh
pc1(config-if)#ip add 192.168.10.1 255.255.255.0
pc1(config-if)#exit
pc1(config)#ip default-gateway 192.168.10.254
pc1(config)#end
PC2
pc2#config t
pc2(config)#int e0/0
pc2(config-if)#no sh
pc2(config-if)#ip add 192.168.20.1 255.255.255.0
pc2(config-if)#exit
pc2(config)#ip default-gateway 192.168.20.254
SW3
SW3#vlan database
SW3(vlan)#vlan 10
VLAN 10 added:
Name: VLAN0010
SW3(vlan)#exit
APPLY completed.
Exiting....
SW3#config t
SW3(config)#int f0/0
SW3(config-if)#sw access vlan 10
SW3(config)#int ran f0/1 -2
SW3(config-if-range)#sw tr en dot
SW3(config-if-range)#sw mode tr
SW4
SW4#vlan database
SW4(vlan)#vlan 20
VLAN 20 added:
Name: VLAN0020
SW4(vlan)#exit
APPLY completed.
SW4#conf t
SW4(config)#int f0/0
SW4(config-if)#sw acc vlan 20
SW4(config)#int ran f0/1 -2
SW4(config-if-range)#sw tr en dot
SW4(config-if-range)#sw mode tr
SW4(config-if-range)#end
SW1
SW1#vlan database
SW1(vlan)#vlan 10
VLAN 10 added:
Name: VLAN0010
SW1(vlan)#vlan 20
VLAN 20 added:
Name: VLAN0020
SW1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW1(config)#int vlan 10
SW1(config-if)#ip add 192.168.10.252 255.255.255.0
SW1(config)#int vlan 20
SW1(config-if)#ip add 192.168.20.252 255.255.255.0
SW1(config)#exit
SW1(config)#int ran f0/1 -2
SW1(config-if-range)#sw tr en dot
SW1(config-if-range)#sw mode tr
SW1(config-if-range)#end
SW2
SW2#vlan database
SW2(vlan)#vlan 10
VLAN 10 added:
Name: VLAN0010
SW2(vlan)#vlan 20
VLAN 20 added:
Name: VLAN0020
SW2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW2(config)#int vlan 20
SW2(config-if)#ip add 192.168.20.253 255.255.255.0
SW2(config-if)# int vlan 10
SW2(config-if)#ip add 192.168.10.253 255.255.255.0
SW2(config)#exit
SW2(config)#int ran f0/1 -2
SW2(config-if-range)#sw tr en dot
SW2(config-if-range)#sw mode tr
SW2(config-if-range)#end
vrrp
SW1
SW1#sh run int vlan 10
Building configuration...
Current configuration : 112 bytes
!
interface Vlan10
ip address 192.168.10.252 255.255.255.0
vrrp 1 ip 192.168.10.254
vrrp 1 priority 110
end
SW1#sh run int vlan 20
Building configuration...
Current configuration : 91 bytes
!
interface Vlan20
ip address 192.168.20.252 255.255.255.0
vrrp 2 ip 192.168.20.254
end
SW2
SW2#sh run int vlan 10
Building configuration...
Current configuration : 91 bytes
!
interface Vlan10
ip address 192.168.10.253 255.255.255.0
vrrp 1 ip 192.168.10.254
end
SW2#sh run int vlan 20
Building configuration...
Current configuration : 112 bytes
!
interface Vlan20
ip address 192.168.20.253 255.255.255.0
vrrp 2 ip 192.168.20.254
vrrp 2 priority 110
end
eigrp
SW1
SW1#sh run int f0/0
Building configuration...
Current configuration : 134 bytes
!
interface FastEthernet0/0
description *** Unused for Layer2 EtherSwitch ***
no switchport
ip address 15.1.1.1 255.255.255.0
end
SW1#sh run | s r e
router eigrp 1
network 0.0.0.0
no auto-summary
banner exec ^C
SW2
SW2#sh run int f0/0
Building configuration...
Current configuration : 134 bytes
!
interface FastEthernet0/0
description *** Unused for Layer2 EtherSwitch ***
no switchport
ip address 25.1.1.2 255.255.255.0
end
SW2#sh run | s r e
router eigrp 1
network 0.0.0.0
no auto-summary
banner exec ^C
R5
R5#config t
Enter configuration commands, one per line. End with CNTL/Z.
R5(config)#int f0/0
R5(config-if)#no sh
R5(config-if)#ip add 15.1.1.5 255.255.255.0
R5(config-if)#int f0/1
R5(config-if)#no sh
R5(config-if)#ip add 25.1.1.5 255.255.255.0
R5(config-if)#int lo 0
R5(config-if)#ip add 5.5.5.5 255.255.255.255
R5(config-if)#router ei 1
R5(config-router)#no auto-summary
R5(config-router)#net 0.0.0.0
R5(config-router)#end
测试
正常状态
pc1#ping 5.5.5.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 60/60/60 ms
pc1#traceroute 5.5.5.5
Type escape sequence to abort.
Tracing the route to 5.5.5.5
1 192.168.10.252 64 msec 60 msec 116 msec
2 15.1.1.5 60 msec 56 msec 60 msec
pc2#traceroute 5.5.5.5
Type escape sequence to abort.
Tracing the route to 5.5.5.5
1 192.168.20.253 8 msec 20 msec 20 msec
2 25.1.1.5 24 msec 40 msec 20 msec
SW1 F0/1 down掉
pc1#ping 192.168.10.254
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.10.254, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 60/66/88 ms
pc1#ping 5.5.5.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 60/95/120 ms
SW2 F0/1 down掉
SW1#sh vrrp int vlan 20
Vlan20 - Group 2
State is Master
Virtual IP address is 192.168.20.254
Virtual MAC address is 0000.5e00.0102
Advertisement interval is 1.000 sec
Preemption enabled
Priority is 100
Master Router is 192.168.20.252 (local), priority is 100
Master Advertisement interval is 1.000 sec
Master Down interval is 3.609 sec
SW1#sh vrrp int vlan 10
Vlan10 - Group 1
State is Master
Virtual IP address is 192.168.10.254
Virtual MAC address is 0000.5e00.0101
Advertisement interval is 1.000 sec
Preemption enabled
Priority is 110
Master Router is 192.168.10.252 (local), priority is 110
Master Advertisement interval is 1.000 sec
Master Down interval is 3.570 sec
SW2#sh vrrp interface vlan 20
Vlan20 - Group 2
State is Master
Virtual IP address is 192.168.20.254
Virtual MAC address is 0000.5e00.0102
Advertisement interval is 1.000 sec
Preemption enabled
Priority is 110
Master Router is 192.168.20.253 (local), priority is 110
Master Advertisement interval is 1.000 sec
Master Down interval is 3.570 sec
SW2#sh vrrp interface vlan 10
Vlan10 - Group 1
State is Backup
Virtual IP address is 192.168.10.254
Virtual MAC address is 0000.5e00.0101
Advertisement interval is 1.000 sec
Preemption enabled
Priority is 100
Master Router is 192.168.10.252, priority is 110
Master Advertisement interval is 1.000 sec
Master Down interval is 3.609 sec (expires in 2.665 sec)