GLBP 则不仅具有网络冗余功能,还可以提供负载平衡的功能。通过本实验,我们可以掌握如下技能:
(1) 理解 GLBP 的工作原理
(2) 掌握 GLBP 的配置
⦁ 实验基础配置 使用路由器模拟PC Router(config)#hostname PC PC(config)#interface F0/0 PC(config)#ip address 192.168.1.100 255.255.255.0 PC(config)#no ip routing
R1(config)#interface F0/0 R1(config-if)#ip address 192.168.1.1 255.255.255.0 R1(config)#interface F0/1 R1(config-if)#ip address 192.168.2.1 255.255.255.0 R1(config)#router rip R1(config-router)#network 192.168.1.0 R1(config-router)#network 192.168.2.0
R2(config)#interface F0/0 R2(config-if)#ip address 192.168.1.2 255.255.255.0 R2(config)#interface F0/1 R2(config-if)#ip address 192.168.2.2 255.255.255.0 R2(config)#router rip R2(config-router)#network 192.168.1.0 R2(config-router)#network 192.168.2.0
R3(config)#interface F0/0 R3(config-if)#ip address 192.168.1.3 255.255.255.0 R3(config)#interface F0/1 R3(config-if)#ip address 192.168.2.3 255.255.255.0 R3(config)#router rip R3(config-router)#network 192.168.1.0 R3(config-router)#network 192.168.2.0
R4(config)#interface Loopback0 R4(config-if)#ip address 4.4.4.4 255.0.0.0 R4(config)#interface F0/0 R4(config-if)#ip address 192.168.2.4 255.255.255.0 R4(config)#router rip R4(config-router)#network 4.0.0.0 R4(config-router)#network 192.168.2.0 ⦁ 配置 GLBP
R1(config)#interface F0/0 R1(config-if)#glbp 1 ip 192.168.1.254 //创建 GLBP 组,虚拟网关的 IP 为 192.168.1.254 R1(config-if)#glbp 1 priority 200 //配置优先级,优先级高的路由器成为 AVG,默认为 100 R1(config-if)#glbp 1 preempt //配置 AVG 抢占,否则即使优先级再高,也不会成为 AVG R1(config-if)#glbp 1 authentication md5 key-string cisco //以上是配置认证,防止非法设备接入 R2(config)#interface F0/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
R3(config)#interface F0/0 R3(config-if)#glbp 1 ip 192.168.1.254 R3(config-if)#glbp 1 priority 160 R3(config-if)#glbp 1 preempt R3(config-if)#glbp 1 authentication md5 key-string cisco
⦁ 查看GLBP配置信息 R1#show glbp FastEthernet0/0 - Group 1 State is Active 1 state change, last state change 00:36:43 Virtual IP address is 192.168.1.254 //虚拟网关地址 Hello time 3 sec, hold time 10 sec Next hello sent in 2.432 secs Redirect time 600 sec, forwarder timeout 14400 sec Authentication MD5, key-string Preemption enabled, min delay 0 sec Active is local //说明R1是活动AVG Standby is 192.168.1.2, priority 180 (expires in 7.872 sec) //说明R2是备份AVG Priority 200 (configured) Weighting 100 (default 100), thresholds: lower 1, upper 100 Load balancing: round-robin Group members: ca02.7dc2.0008 (192.168.1.1) local ca03.7dd1.0008 (192.168.1.2) authenticated ca04.7de0.0008 (192.168.1.3) authenticated //以上显示GLBP组成员 There are 3 forwarders (1 active) Forwarder 1 State is Listen 2 state changes, last state change 00:36:03 MAC address is 0007.b400.0101 (learnt) //虚拟网关的MAC地址 Owner ID is ca03.7dd1.0008 Redirection enabled, 597.888 sec remaining (maximum 600 sec) Time to live: 14397.888 sec (maximum 14400 sec) Preemption enabled, min delay 30 sec Active is 192.168.1.2 (primary), weighting 100 (expires in 8.832 sec) Client selection count: 1 Forwarder 2 State is Listen 2 state changes, last state change 00:36:00 MAC address is 0007.b400.0102 (learnt) Owner ID is ca04.7de0.0008 Redirection enabled, 598.144 sec remaining (maximum 600 sec) Time to live: 14398.144 sec (maximum 14400 sec) Preemption enabled, min delay 30 sec Active is 192.168.1.3 (primary), weighting 100 (expires in 8.928 sec) Forwarder 3 State is Active 1 state change, last state change 00:36:33 MAC address is 0007.b400.0103 (default) Owner ID is ca02.7dc2.0008 Redirection enabled Preemption enabled, min delay 30 sec Active is local, weighting 100
⦁ 检查GLBP的负载平衡
在PC上ping 4.4.4.4,然后查看ARP PC#show ip arp Protocol Address Age (min) Hardware Addr Type Interface Internet 4.4.4.4 0 0007.b400.0101 ARPA FastEthernet0/0 Internet 192.168.1.100 - ca01.7db3.0000 ARPA FastEthernet0/0
清除ARP信息之后,重新ping,并查看ARP PC#show ip arp Protocol Address Age (min) Hardware Addr Type Interface Internet 4.4.4.4 0 0007.b400.0103 ARPA FastEthernet0/0 Internet 192.168.1.100 - ca01.7db3.0000 ARPA FastEthernet0
由此说明GLBP响应ARP请求时,每次使用不同的MAC地址,从而实现负载平衡。