R1#sh run<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Building configuration...

……….

interface Ethernet0/0

 ip address 192.168.1.1 255.255.255.0

 half-duplex

 glbp 1 ip 192.168.1.254

 glbp 1 priority 200

 glbp 1 preempt

!

interface Ethernet0/1

 ip address 192.168.2.1 255.255.255.0

 half-duplex

 

router rip

 version 2

 passive-interface Ethernet0/0

 network 192.168.1.0

 network 192.168.2.0

 no auto-summary

!

 

R2#sh run

Building configuration...

………….

interface Ethernet0/0

 ip address 192.168.1.2 255.255.255.0

 half-duplex

 glbp 1 ip 192.168.1.254

 glbp 1 priority 180

 glbp 1 preempt

!

interface Ethernet0/1

 ip address 192.168.2.2 255.255.255.0

 half-duplex

!

router rip

 version 2

 passive-interface Ethernet0/0

 network 192.168.1.0

 network 192.168.2.0

!

 

R3#sh run

Building configuration...

………..

interface Ethernet0/0

 ip address 192.168.1.3 255.255.255.0

 half-duplex

 glbp 1 ip 192.168.1.254

 glbp 1 priority 160

 glbp 1 preempt

!

interface Ethernet0/1

 ip address 192.168.2.3 255.255.255.0

 half-duplex

!

router rip

 version 2

 passive-interface Ethernet0/0

 network 192.168.1.0

 network 192.168.2.0

!

其他设配的配置按照拓扑图配置,确保直连链路的连通性。

 

1R1上查看GLBP的信息:

R1#sh glbp

Ethernet0/0 - Group 1

  State is Active

    2 state changes, last state change 00:18:28

  Virtual IP address is 192.168.1.254  // 虚拟网关是192.168.1.254

  Hello time 3 sec, hold time 10 sec

    Next hello sent in 1.324 secs

  Redirect time 600 sec, forwarder time-out 14400 sec

  Preemption enabled, min delay 0 sec

  Active is local        // 说明R1是活动的AVG

  Standby is 192.168.1.2, priority 180 (expires in 9.320 sec)  //说明R2是备份AVG

  Priority 200 (configured)

  Weighting 100 (default 100), thresholds: lower 1, upper 100

  Load balancing: round-robin

  Group members:

    cc01.0d80.0000 (192.168.1.1) local

    cc02.0d80.0000 (192.168.1.2)

    cc03.0d80.0000 (192.168.1.3)       // 显示BGLP的成员

  There are 3 forwarders (1 active)

  Forwarder 1

    State is Active

      1 state change, last state change 00:18:18

MAC address is 0007.b400.0101 (default)        // 虚拟网关的其中一个MAC地址

                                          

                                            此段说明R10007.b400.0101的活动路由器,也就是说有发往007.b400.0101的数据,将由R1接收并转发。

    Owner ID is cc01.0d80.0000

    Redirection enabled

    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 cc02.0d80.0000

    Redirection enabled, 598.132 sec remaining (maximum 600 sec)

    Time to live: 14398.132 sec (maximum 14400 sec)

    Preemption enabled, min delay 30 sec

    Active is 192.168.1.2 (primary), weighting 100 (expires in 8.128 sec)

  Forwarder 3

    State is Listen

    MAC address is 0007.b400.0103 (learnt)

    Owner ID is cc03.0d80.0000

    Redirection enabled, 599.320 sec remaining (maximum 600 sec)

    Time to live: 14399.320 sec (maximum 14400 sec)

    Preemption enabled, min delay 30 sec

Active is 192.168.1.3 (primary), weighting 100 (expires in 9.316 sec)

 

从上面得知:

R1: 0007.b400.0101 的活动路由器

R2: 0007.b400.0102 的活动路由器

R3: 0007.b400.0103的活动路由器

 

2 检查GLBP的负载均衡功能

     PCping <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />4.4.4.4

    PC#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:

.!!!!

 

再查看ARP

PC#sh arp

Protocol  Address          Age (min)  Hardware Addr   Type   Interface

Internet  192.168.1.100           -   cc05.0d18.0000  ARPA   Ethernet0/0

Internet  192.168.1.254          13   0007.b400.0101  ARPA   Ethernet0/0

 

以上表明PCARP请求获得网关(192.168.1.254)MAC00-07-b4-00-01-01

 

清空ARP缓存表,再次ping 4.4.4.4,查看ARP缓存

PC#clear arp

PC#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 = 16/228/1032 ms

PC#sh arp

Protocol  Address          Age (min)  Hardware Addr   Type   Interface

Internet  192.168.1.100           -   cc05.0d18.0000  ARPA   Ethernet0/0

Internet  192.168.1.254           0   0007.b400.0103  ARPA   Ethernet0/0

 

以上表明PCARP请求获得网关(192.168.1.254)MAC00-07-b4-00-01-03

也就是说GLBP响应ARP请求时,每次会用不同的MAC响应,从而实现负载平衡。

3  检查GLBP的冗余功能

 

确定了192.168.1.254MAC地址是0007.b400.0103

PCping 4.4.4.4 重复1000次,并在中间断开R3e0/0端口

PC#ping 4.4.4.4 repeat 1000

 

Type escape sequence to abort.

Sending 1000, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:

.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!!!!!!!!.....!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

 

             可以看到在R3发生故障的时候,很快就有其他路由器顶替它的工作。

PC#sh arp

Protocol  Address          Age (min)  Hardware Addr   Type   Interface

Internet  192.168.1.100           -   cc05.0d18.0000  ARPA   Ethernet0/0

Internet  192.168.1.254           5   0007.b400.0103  ARPA   Ethernet0/0

 

再在R1上查看glbp的信息:

Ethernet0/0 - Group 1

…………

  Forwarder 3

    State is Listen

      4 state changes, last state change 00:01:43

    MAC address is 0007.b400.0103 (learnt)

    Owner ID is cc03.0d80.0000

    Redirection enabled, 597.940 sec remaining (maximum 598 sec)

    Time to live: 14397.940 sec (maximum 14398 sec)

    Preemption enabled, min delay 30 sec

    Active is 192.168.1.2 (secondary), weighting 100 (expires in 9.936 sec)

Arp replies sent: 2

可以看出路由器R2顶替了路由R3的功能,可以看出gblp既有负载均衡的功能还有冗余备份的功能!