1、网关冗余和负载均衡VRRP网关冗余和负载均衡 VRRPR1、交换机SW1 (R6 )交换机 SW2 (R4)配置R6e nableR6#co nf tR6(co nfig)#host name SW1SW1 (con fig)#i nt faO/OSW1 (con fig-if)# no shutdow nSW1 (con fig-if)#exitSW1 (con fig)#i nt faO/1SW1 (con fig-if)# no shutdow nSW1 (con fig-if)#exitSW1 (con fig)#i nt fa0/2SW1 (con fig-if)# no shutd
2、ow nSW1 (con fig-if)#exitSW1#vla n databaseSW1 (vla n) #vla n 2VLAN 2 added:Name: VLAN0002SW1 (vlan )#exitSW1#co nf tSW1 (con fig)#i nt range faO/O - 2SW1 (config-if-range)#switchport access vlan 2SW1 (con fig-if-ra nge)#exitSW1 (con fig-if-ra nge)#exitSW1(config)#int vlan 2SW1(config-if)#ip add 192
3、.168.13.2 255.255.255.0SW1(config-if)#no shutdownSW1(co nfig-if)#exitSW1#R4venab-eR4#conf fR4(COMg)#hosf SW2Sw2(config)#in二aoMSw2(confign#no shutdownSw2(confign#e”H配置 PC1 ( R7 ) PC2 ( R5 )R7e nableR7#co nf tR7(co nfig)#host PC1PC1(con fig)# no ip routi ngPC1(co nfig)#i nt e0/0PC1(config-if)#ip add 1
4、92.168.13.100 255.255.255.0PC1(config-if)#no shutdownPC1(co nfig-if)#exitPC1(config)#ip default-gateway 192.168.13.2PC1(co nfig)#exitPC1#R5e nableR5#co nf tR5(co nfig)#host PC2PC2 (config)#no ip routingPC2 (con fig)#i nt e0/0PC2 (con fig-if)#ip add 192.168.20.100 255.255.255.0PC2 (con fig-if)# no sh
5、utdow nPC2 (con fig-if)#exitPC2 (con fig)#ip default-gateway 192.168.20.2三、对路由器进行基本配置R1#co nf tR1(co nfig)#i nt eO/OR1(config-if)#ip add 192.168.13.1 255.255.255.0R1(c on fig-if)# no shutdow nR1(co nfig-if)#exitR1(co nfig)#i nt s1/0R1(config-if)#ip add 192.168.12.1 255.255.255.0R1(c on fig-if)# no s
6、hutdow nR1(co nfig-if)#exitR1(co nfig)#R2e nableR2#co nf tR2(co nfig)#i nt s1/0R2(config-if)#ip add 192.168.12.2 255.255.255.0R2(co nfig-if)#clock rate 128000R2(c on fig-if)# no shutdow nR2(co nfig-if)#exitR2(co nfig)# int s1/1R2(config-if)#ip add 192.168.23.2 255.255.255.0R2(co nfig-if)#clock rate
7、128000R2(c on fig-if)# no shutdow nR2(co nfig-if)#exitR2(co nfig)#i nt e0/0R2(config-if)#ip add 192.168.20.2 255.255.255.0R2(c on fig-if)# no shutdow nR2(co nfig-if)#exitR2(co nfig)#exitR2#R3e nableR3#co nf tR3(co nfig)#i nt s1/0R3(config-if)#ip add 192.168.23.3 255.255.255.0R3(c on fig-if)# no shut
8、dow nR3(co nfig)#i nt e0/0R3(config-if)#ip add 192.168.13.3 255.255.255.0R3(c on fig-if)# no shutdow nR3(co nfig-if)#exitR3(co nfig)#四、配置路由协议R1#co nf tR1(config)#router ripR1(co nfig-router)# net 192.168.12.0R1(co nfig-router)# net 192.168.13.0R1(c on fig-router)#passive-i nterface e0/0/把e0/0接口设为被接口
9、,为了防止从该接口发送 RIP信息给R3R1(c on fig-router)#exitR1(co nfig)#exitR1#R2#co nf tR2(c on fig)#router ripR2(co nfig-router)# net 192.168.12.0R2(co nfig-router)# net 192.168.23.0R2(co nfig-router)# net 192.168.20.0R2(c on fig-router)#passive-i nterface e0/0R2(c on fig-router)#exitR2(co nfig)#exitR2#R3#co nf t
10、R3(c on fig)#router ripR3(co nfig-router)# net 192.168.13.0R3(co nfig-router)# net 192.168.23.0R3(c on fig-router)#passive-i nterface e0/0R3(c on fig-router)#exitR3(co nfig)#exitR3#五、查看路由表R1#sh ip routeCodes: C - conn ected, S - static, R - RIP , M - mobile, B - BGPD - EIGRP , EX - EIGRP external, O
11、 - OSPF, IA - OSPF in ter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS in ter area, * - can didate default, U - per-user static route o - ODR, P
12、 - periodic downloaded static routeGateway of last resort is not setC 192.168.12.0/24 is directly conn ected, Serial1/0C 192.168.13.0/24 is directly conn ected, 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.13.3, 00:01:12, Ethernet0/0120/
13、1 via 192.168.12.2, 00:00:06, Serial1/0R1#前后对比R1#sh ip routeCodes: C - conn ected, S - static, R - RIP , M - mobile, B - BGPD - EIGRP , EX - EIGRP external, O - OSPF, IA - OSPF in ter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external ty
14、pe 2i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS in ter area, * - can didate 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 conn ected, Serial1/0C 192.168.13.0/24 is di
15、rectly conn ected, 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 route,M - mobile, B - BGPCodes: C - conn ected, S - static, R - RIP D - EIGRP , EX - EIGRP external, O - OSPF, IA - OSPF in ter area N1
16、- OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS in ter area, * - can didate default, U - per-user static route o - ODR, P - periodic dow nl oaded static ro
17、uteGateway of last resort is not setC 192.168.12.0/24 is directly conn ected, Serial1/0R 192.168.13.0/24 120/1 via 192.168.23.3, 00:00:17, Serial1/1120/1 via 192.168.12.1,00:00:14, Serial1/0C 192.168.20.0/24 is directly conn ected, Ethernet0/0C 192.168.23.0/24 is directly conn ected, Serial1/1R2#R3#
18、sh ip routeCodes: C - conn ected, S - static, R - RIP , M - mobile, B - BGPD - EIGRP , EX - EIGRP external, O - OSPF, IA - OSPF in ter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2i - IS-IS, su - IS-IS summary, L1 - IS-IS level
19、-1, L2 - IS-IS level-2 ia - IS-IS in ter area, * - can didate default, U - per-user static route o - ODR, P - periodic downloaded static routeGateway of last resort is not setR 192.168.12.0/24 120/1 via 192.168.23.2, 00:00:16, Serial1/0C 192.168.13.0/24 is directly conn ected, Ethernet。/。R 192.168.2
20、0.0/24 120/1 via 192.168.23.2, 00:00:12, Serial1/0C 192.168.23.0/24 is directly conn ected, Serial1/0R3#五、测试R1#pi ng 192.168.20.100Type escape seque nee to abort.Se nding 5, 100-byte ICMP Echos to 192.168.20.100, timeout is 2 seco nds:!Success rate is 100 perce nt (5/5), roun d-trip min/avg/max = 60
21、/80/120 msR1#六、配置多个VRRP组R1#co nf tR1(config)#track 100 int s1/0 line-protocol / 定义跟踪目标R1(co nfig-track)#exitR1(co nfig)#i nt e0/0R1(co nfig-if)#vrrp 1 ip 192.168.13.254R1(co nfig-if)#vrrp 1 priority 120/命令不存在R1(c on fig-if)#vrrp 1 preemptR1(config-if)#vrrp 1 authentication md5 key-string ciscoR1(co
22、nfig-if)#vrrp 1 track 100 decreme nt 30R1(config-if)#vrrp 2 ip 192.168.13.253R1(c on fig-if)#vrrp 2 preemptR1(config-if)#vrrp 2 authentication md5 key-string ciscoR1(co nfig-if)#R3#co nf tR3(co nfig)#track 100 int s1/0 lin e-protocolR3(co nfig-track)#exitR3(co nfig)#i nt e0/0R3(co nfig-if)#vrrp 1 ip
23、 192.168.13.2R3(c on fig-if)#vrrp 1 preemptR3(c on fig-if)#vrrp 1 authe nticati on md5 key-stri ng ciscoR3(co nfig-if)#vrrp 2 ip 192.168.13.253R3(co nfig-if)#vrrp 2 priority 120R3(c on fig-if)#vrrp 2 preemptR3(c on fig-if)#vrrp 2 authe nticati on md5 key-stri ng ciscoR3(co nfig-if)#vrrp 3 track 100
24、decreme nt 30R3(co nfig-if)#exitR3(co nfig)#exitR3#七、查看VRRPR1#sh vrrp briefIn terfaceGrp Pri TimeOwn Pre StateMaster addrGroup addrEtO/O1120 3531Y Master192.168.13.1192.168.13.254Et0/02100 3609Y Backup192.168.13.3192.168.13.253R1#R3#sh vrrp briefIn terfaceGrp Pri TimeOwn Pre StateMaster addrGroup ad
25、drEt0/01100 3609Y Backup192.168.13.1EtO/O192.168.13.253R3#2 120 3531Y Master192.168.13.3八、检测查看VRRPR1#co nf tEn ter con figurati on comma nds, one per line. End with CNTL/Z.R1(co nfig)#i nt s1/0R1(co nfig-if)#shutdownR1(co nfig-if)#exitR1(co nfig)#exitR1#sh vrrp briefIn terfaceEt0/0192.168.13.254Et0/
26、0192.168.13.253R1#R3#sh vrrp briefIn terfaceGrp Pri Time12Own Pre State90 3531100 3609Master addrYBackupYBackupGroup addr192.168.13.3192.168.13.3Grp Pri TimeOwn Pre StateMaster addrGroup addr192.168.13.254R1#co nf tR1(co nfig)#i nt s1/0R1(c on fig-if)# no shutdow nR1(co nfig-if)#exitR1(co nfig)#exit
27、R1#sh vrrp briefIn terfaceGrp Pri TimeOwn Pre StateMaster addrGroup addrEt0/0192.168.13.2541120 3531Y Master192.168.13.1Et0/0192.168.13.253R1#2100 3609Y Backup192.168.13.3R3#sh vrrp briefIn terfaceGrp Pri TimeOwn Pre StateMaster addrGroup addrEt0/01100 3609Y Backup192.168.13.1EtO/O192.168.13.253R3#2 120 3531Y Master192.168.13.3
copyright@ 2008-2023 冰点文库 网站版权所有
经营许可证编号:鄂ICP备19020893号-2