网关冗余和负载均衡GLBP
配置SW1(R6)SW2(R5)
R6>enable
R6#conf t
R6(config)#host SW1
SW1 (config)#int range fa0/0 - 3
SW1 (config-if-range)#no shutdown
SW1#vlan database
SW1 (vlan)#vlan 2
VLAN 2 added:
Name: VLAN0002
SW1 (vlan)#exit
SW1#conf t
SW1 (config)#int range fa0/0 - 3
SW1 (config-if-range)#switchport access vlan 2
SW1 (config-if-range)#exit
SW1 (config)#exit
SW1#
R5>enable
R5#conf t
R5(config)#host SW2
SW2(config)#int range fa0/0 - 3
SW2(config-if-range)#no shutdown
SW2(config-if-range)#exit
SW2(config)#exit
SW2#vlan database
SW2(vlan)#vlan 2
VLAN 2 added:
Name: VLAN0002
SW2(vlan)#exit
SW2#conf t
SW2(config)#int range fa0/0 -3
SW2(config-if-range)#switchport access vlan 2
SW2(config-if-range)#exit
SW2(config)#exit
SW2#
配置PC1(R7)
R7>enable
R7#conf t
R7(config)#host PC1
PC1 (config)#no ip routing
PC1 (config)#int e0/0
PC1 (config-if)#ip add 192.168.1.100 255.255.255.0
PC1 (config-if)#no shutdown
PC1 (config-if)#exit
PC1 (config)#ip default-gateway 192.168.1.1
PC1 (config)#ip default-gateway 192.168.1.2
PC1 (config)#ip default-gateway 192.168.1.3
PC1 (config)#exit
PC1#
网关直接指向192.168.1.254
三、配置路由器
R1>enable
R1#conf t
R1(config)#int e0/0
R1(config-if)#ip add 192.168.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#int e0/1
R1(config-if)#ip add 192.168.2.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#exit
R1#
R2>enable
R2#conf t
R2(config)#int e0/0
R2(config-if)#ip add 192.168.1.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#int e0/1
R2(config-if)#ip add 192.168.2.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#exit
R2#
R3>enable
R3#conf t
R3(config)#int e0/0
R3(config-if)#ip add 192.168.1.3 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config)#int e0/1
R3(config-if)#ip add 192.168.2.3 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config)#exit
R3#
R4>enable
R4#conf t
R4(config)#int lo 0
R4(config-if)#ip add 4.4.4.4 255.255.255.0
R4(config-if)#exit
R4(config)#int e0/0
R4(config-if)#ip add 192.168.2.4 255.255.255.0
R4(config-if)#no shutdown
R4(config-if)#exit
R4(config)#exit
R4#
配置RIP路由协议
R1#conf t
R1(config)#router rip
R1(config-router)#net 192.168.1.0
R1(config-router)#net 192.168.2.0
R1(config-router)#passive-interface e0/0
R1(config-router)#exit
R1(config)#exit
R1#
R2#conf t
R2(config)#router rip
R2(config-router)#net 192.168.1.0
R2(config-router)#net 192.168.2.0
R2(config-router)#passive-interface e0/0
R2(config-router)#exit
R2(config)#exit
R2#
R3#conf t
R3(config)#router rip
R3(config-router)#net 192.168.1.0
R3(config-router)#net 192.168.2.0
R3(config-router)#passive-interface e0/0
R3(config-router)#exit
R3(config)#exit
R3#
R4#conf t
R4(config)#router rip
R4(config-router)#net 192.168.2.0
R4(config-router)#net 4.4.4.0
R4(config-router)#passive-interface e0/0
R4(config-router)#exit
R4(config)#exit
R4#
查看路由表
R1#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
R 4.0.0.0/8 [120/1] via 192.168.2.4, 00:00:53, Ethernet0/1
C 192.168.1.0/24 is directly connected, Ethernet0/0
C 192.168.2.0/24 is directly connected, Ethernet0/1
R1#
R2#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
R 4.0.0.0/8 [120/1] via 192.168.2.4, 00:01:04, Ethernet0/1
C 192.168.1.0/24 is directly connected, Ethernet0/0
C 192.168.2.0/24 is directly connected, Ethernet0/1
R2#
R3#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
R 4.0.0.0/8 [120/1] via 192.168.2.4, 00:01:16, Ethernet0/1
C 192.168.1.0/24 is directly connected, Ethernet0/0
C 192.168.2.0/24 is directly connected, Ethernet0/1
R3#
R4#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
4.0.0.0/24 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, Loopback0
R 192.168.1.0/24 [120/1] via 192.168.2.3, 00:00:01, Ethernet0/0
[120/1] via 192.168.2.2, 00:00:23, Ethernet0/0
[120/1] via 192.168.2.1, 00:00:23, Ethernet0/0
C 192.168.2.0/24 is directly connected, Ethernet0/0
R4#
测试
PC1#ping 4.4.4.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 92/108/136 ms
PC1#
R4#ping 192.168.1.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.100, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 64/87/144 ms
R4#
配置GLBP
R1#conf t
R1(config)#int e0/0
R1(config-if)#glbp 1 ip 192.168.1.254
R1(config-if)#glbp 1 priority 200
R1(config-if)#glbp 1 preempt
R1(config-if)#glbp 1 authentication md5 key-string cisco
R1(config-if)#exit
R1(config)#exit
R1#
R2#conf t
R2(config)#int e0/0
R2(config-if)#glbp 1 ip 192.168.1.254
R2(config-if)#glbp 1 priority 180
R2(config-if)#glbp 1 preempt
R2(config-if)#glbp 1 authentication md5 key-string cisco
R2(config)#exit
R2#
R3#conf t
R3(config)#int e0/0
R3(config-if)#glbp 1 ip 192.168.1.254
R3(config-if)#glbp 1 priority
R3(config-if)#glbp 1 priority 160
R3(config-if)#glbp 1 preempt
R3(config-if)#glbp 1 authentication md5 key-string cisco
R3(config-if)#exit
R3(config)#exit
R3#
八、查看GLBP
R1#sh glbp
Ethernet0/0 - Group 1
State is Active
2 state changes, last state change 00:06:16
Virtual IP address is 192.168.1.254
Hello time 3 sec, hold time 10 sec
Next hello sent in 1.648 secs
Redirect time 600 sec, forwarder time-out 14400 sec
Authentication MD5, key-string "cisco"
Preemption enabled, min delay 0 sec
Active is local
Standby is 192.168.1.2, priority 180 (expires in 9.548 sec)
Priority 200 (configured)
Weighting 100 (default 100), thresholds: lower 1, upper 100
Load balancing: round-robin
Group members:
cc00.0270.0000 (192.168.1.1) local
cc01.0270.0000 (192.168.1.2) authenticated
cc02.0270.0000 (192.168.1.3) authenticated
There are 3 forwarders (1 active)
Forwarder 1
State is Active
1 state change, last state change 00:06:06
MAC address is 0007.b400.0101 (default)
Owner ID is cc00.0270.0000
Redirection enabled
--More--
*Mar 1 00:40:12.979: %CDP-4-DUPLEX_MISMATCH: duplex mismatch discovered on Ethernet0/1 (not full duplex), with SW2 FastEthernet0/1 (full duplex).
*Mar 1 00:40:13.035: %CDP-4-DUPLEX_MISMATCH: duplex mismatch discovered on Ethernet0/0 (not full duplex), with SW1 FastEthernet0/1 (full duplex).
Preemption enabled, min delay 30 sec
Active is local, weighting 100
Forwarder 2
State is Listen
MAC address is 0007.b400.0102 (learnt)
Owner ID is cc01.0270.0000
Redirection enabled, 598.468 sec remaining (maximum 600 sec)
Time to live: 14397.876 sec (maximum 14400 sec)
Preemption enabled, min delay 30 sec
Active is 192.168.1.2 (primary), weighting 100 (expires in 7.064 sec)
Forwarder 3
State is Listen
MAC address is 0007.b400.0103 (learnt)
Owner ID is cc02.0270.0000
Redirection enabled, 599.580 sec remaining (maximum 600 sec)
Time to live: 14399.376 sec (maximum 14400 sec)
Preemption enabled, min delay 30 sec
Active is 192.168.1.3 (primary), weighting 100 (expires in 8.920 sec)
R1#
实验错误,RIPv1不支持认证,改为RIPv2或者EIGRP协议