1、网关冗余和负载均衡VRRP网关冗余和负载均衡VRRP一、 交换机SW1(R6)交换机SW2(R4)配置R6enableR6#conf tR6(config)#hostname SW1SW1 (config)#int fa0/0SW1 (config-if)#no shutdownSW1 (config-if)#exitSW1 (config)#int fa0/1SW1 (config-if)#no shutdownSW1 (config-if)#exitSW1 (config)#int fa0/2SW1 (config-if)#no shutdownSW1 (config-if)#exitSW
2、1#vlan databaseSW1 (vlan)#vlan 2VLAN 2 added: Name: VLAN0002SW1 (vlan)#exitSW1#conf tSW1 (config)#int range fa0/0 - 2SW1 (config-if-range)#switchport access vlan 2SW1 (config-if-range)#exitSW1 (config-if-range)#exitSW1(config)#int vlan 2SW1(config-if)#ip add 192.168.13.2 255.255.255.0SW1(config-if)#
3、no shutdownSW1(config-if)#exitSW1(config)#exitSW1#R4enableR4#conf tR4(config)#host SW2SW2(config)#int fa0/1SW2(config-if)#no shutdownSW2(config-if)#exitSW2(config)#int f0/0SW2(config-if)#no shutdownSW2(config-if)#exitSW2(config)#exitSW2#vlan databaseSW2(vlan)#vlan 2VLAN 2 added: Name: VLAN0002SW2(vl
4、an)#exitSW2#conf tSW2(config)#int range fa0/0 - 1SW2(config-if-range)#switchport access vlan 2SW2(config-if-range)#endSW2#二、 配置PC1(R7)PC2(R5)R7enableR7#conf tR7(config)#host PC1PC1(config)#no ip routingPC1(config)#int e0/0PC1(config-if)#ip add 192.168.13.100 255.255.255.0PC1(config-if)#no shutdownPC
5、1(config-if)#exitPC1(config)#ip default-gateway 192.168.13.2PC1(config)#exitPC1#R5enableR5#conf tR5(config)#host PC2PC2 (config)#no ip routingPC2 (config)#int e0/0PC2 (config-if)#ip add 192.168.20.100 255.255.255.0PC2 (config-if)#no shutdownPC2 (config-if)#exitPC2 (config)#ip default-gateway 192.168
6、.20.2三、 对路由器进行基本配置R1#conf tR1(config)#int e0/0R1(config-if)#ip add 192.168.13.1 255.255.255.0R1(config-if)#no shutdownR1(config-if)#exitR1(config)#int s1/0R1(config-if)#ip add 192.168.12.1 255.255.255.0R1(config-if)#no shutdownR1(config-if)#exitR1(config)#R2enableR2#conf tR2(config)#int s1/0R2(confi
7、g-if)#ip add 192.168.12.2 255.255.255.0R2(config-if)#clock rate 128000R2(config-if)#no shutdownR2(config-if)#exitR2(config)#int s1/1R2(config-if)#ip add 192.168.23.2 255.255.255.0R2(config-if)#clock rate 128000R2(config-if)#no shutdownR2(config-if)#exitR2(config)#int e0/0R2(config-if)#ip add 192.168
8、.20.2 255.255.255.0R2(config-if)#no shutdownR2(config-if)#exitR2(config)#exitR2#R3enableR3#conf tR3(config)#int s1/0R3(config-if)#ip add 192.168.23.3 255.255.255.0R3(config-if)#no shutdownR3(config)#int e0/0R3(config-if)#ip add 192.168.13.3 255.255.255.0R3(config-if)#no shutdownR3(config-if)#exitR3(
9、config)#四、 配置路由协议R1#conf tR1(config)#router ripR1(config-router)#net 192.168.12.0R1(config-router)#net 192.168.13.0R1(config-router)#passive-interface e0/0 /把e0/0接口设为被接口,为了防止从该接口发送RIP信息给R3R1(config-router)#exitR1(config)#exitR1#R2#conf tR2(config)#router ripR2(config-router)#net 192.168.12.0R2(confi
10、g-router)#net 192.168.23.0R2(config-router)#net 192.168.20.0R2(config-router)#passive-interface e0/0R2(config-router)#exitR2(config)#exitR2#R3#conf tR3(config)#router ripR3(config-router)#net 192.168.13.0R3(config-router)#net 192.168.23.0R3(config-router)#passive-interface e0/0R3(config-router)#exit
11、R3(config)#exitR3#五、查看路由表R1#sh ip routeCodes: 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-
12、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 routeGateway of last resort is not setC 192.168.12.0/24 is directly connected, Serial1/0C 192.168.13.0/24 is directly connected, Ethernet
13、0/0R 192.168.20.0/24 120/1 via 192.168.12.2, 00:00:28, Serial1/0R 192.168.23.0/24 120/1 via 192.168.13.3, 00:01:12, Ethernet0/0 120/1 via 192.168.12.2, 00:00:06, Serial1/0R1#前后对比R1#sh ip routeCodes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA
14、- 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 do
15、wnloaded static routeGateway of last resort is not setC 192.168.12.0/24 is directly connected, Serial1/0C 192.168.13.0/24 is directly connected, Ethernet0/0R 192.168.20.0/24 120/1 via 192.168.12.2, 00:00:28, Serial1/0R 192.168.23.0/24 120/1 via 192.168.12.2, 00:00:02, Serial1/0R1#R2#sh ip routeCodes
16、: 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 l
17、evel-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static routeGateway of last resort is not setC 192.168.12.0/24 is directly connected, Serial1/0R 192.168.13.0/24 120/1 via 192.168.23.3, 00:00:17, Serial1/1 120/1 via 192.168.12.1, 00:00:1
18、4, Serial1/0C 192.168.20.0/24 is directly connected, Ethernet0/0C 192.168.23.0/24 is directly connected, Serial1/1R2#R3#sh ip routeCodes: 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 N
19、SSA 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 routeGateway of last resort is not setR 192.1
20、68.12.0/24 120/1 via 192.168.23.2, 00:00:16, Serial1/0C 192.168.13.0/24 is directly connected, Ethernet0/0R 192.168.20.0/24 120/1 via 192.168.23.2, 00:00:12, Serial1/0C 192.168.23.0/24 is directly connected, Serial1/0R3#五、 测试R1#ping 192.168.20.100Type escape sequence to abort.Sending 5, 100-byte ICM
21、P Echos to 192.168.20.100, timeout is 2 seconds:!Success rate is 100 percent (5/5), round-trip min/avg/max = 60/80/120 msR1#六、 配置多个VRRP组R1#conf tR1(config)#track 100 int s1/0 line-protocol /定义跟踪目标R1(config-track)#exitR1(config)#int e0/0R1(config-if)#vrrp 1 ip 192.168.13.254R1(config-if)#vrrp 1 prior
22、ity 120R1(config-if)#vrrp 1 preemptR1(config-if)#vrrp 1 authentication md5 key-string cisco /命令不存在R1(config-if)#vrrp 1 track 100 decrement 30R1(config-if)#vrrp 2 ip 192.168.13.253R1(config-if)#vrrp 2 preemptR1(config-if)#vrrp 2 authentication md5 key-string ciscoR1(config-if)#R3#conf tR3(config)#tra
23、ck 100 int s1/0 line-protocolR3(config-track)#exitR3(config)#int e0/0R3(config-if)#vrrp 1 ip 192.168.13.2R3(config-if)#vrrp 1 preemptR3(config-if)#vrrp 1 authentication md5 key-string ciscoR3(config-if)#vrrp 2 ip 192.168.13.253R3(config-if)#vrrp 2 priority 120R3(config-if)#vrrp 2 preemptR3(config-if
24、)#vrrp 2 authentication md5 key-string ciscoR3(config-if)#vrrp 3 track 100 decrement 30R3(config-if)#exitR3(config)#exitR3#七、 查看VRRPR1#sh vrrp briefInterface Grp Pri Time Own Pre State Master addr Group addrEt0/0 1 120 3531 Y Master 192.168.13.1 192.168.13.254Et0/0 2 100 3609 Y Backup 192.168.13.3 1
25、92.168.13.253R1#R3#sh vrrp briefInterface Grp Pri Time Own Pre State Master addr Group addrEt0/0 1 100 3609 Y Backup 192.168.13.1 192.168.13.254Et0/0 2 120 3531 Y Master 192.168.13.3 192.168.13.253R3#八、检测查看VRRPR1#conf tEnter configuration commands, one per line. End with CNTL/Z.R1(config)#int s1/0R1
26、(config-if)#shutdownR1(config-if)#exitR1(config)#exitR1#sh vrrp briefInterface Grp Pri Time Own Pre State Master addr Group addrEt0/0 1 90 3531 Y Backup 192.168.13.3 192.168.13.254Et0/0 2 100 3609 Y Backup 192.168.13.3 192.168.13.253R1#R3#sh vrrp briefInterface Grp Pri Time Own Pre State Master addr
27、 Group addrEt0/0 1 100 3609 Y Master 192.168.13.3 192.168.13.254Et0/0 2 120 3531 Y Master 192.168.13.3 192.168.13.253R3#R1#conf tR1(config)#int s1/0R1(config-if)#no shutdownR1(config-if)#exitR1(config)#exitR1#sh vrrp briefInterface Grp Pri Time Own Pre State Master addr Group addrEt0/0 1 120 3531 Y Master 192.168.13.1 192.168.13.254Et0/0 2 100 3609 Y Backup 192.168.13.3 192.168.13.253R1#R3#sh vrrp briefInterface Grp Pri Time Own Pre State Master addr Group addrEt0/0 1 100 3609 Y Backup 192.168.13.1 192.168.13.254Et0/0 2 120 3531 Y Master 192.168.13.3 192.168.13.253R3#
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1