VRRP、Track与NQA联动配置举例(Master监视上行链路)

原文

http://www.h3c.com/cn/d_201708/1018729_30005_0.htm#_Toc488338729

1. 组网需求

  • Host A需要访问Internet上的Host B,Host A的缺省网关为10.1.1.10/24;
  • Switch A和Switch B属于虚拟IP地址为10.1.1.10的备份组1;
  • 当Switch A正常工作时,Host A发送给Host B的报文通过Switch A转发;当通过NQA监测到Switch A上行链路不通时,Host A发送给Host B的报文通过Switch B转发。

2. 组网图

图1-1 VRRP、Track与NQA联动配置组网图

 

3. 配置步骤

(1)     按照图1-1创建VLAN,在VLAN中加入对应的端口,并配置各VLAN接口的IP地址,具体配置过程略。

(2)     在Switch A上配置NQA测试组

<SwitchA> system-view

# 创建管理员名为admin、操作标签为test的NQA测试组。

[SwitchA] nqa entry admin test

# 配置测试类型为ICMP-echo。

[SwitchA-nqa-admin-test] type icmp-echo

# 配置目的地址为10.1.2.2。

[SwitchA-nqa-admin-test-icmp-echo] destination ip 10.1.2.2

# 测试频率为100ms。

[SwitchA-nqa-admin-test-icmp-echo] frequency 100

# 配置联动项1(连续失败5次触发联动)。

[SwitchA-nqa-admin-test-icmp-echo] reaction 1 checked-element probe-fail threshold-type consecutive 5 action-type trigger-only

[SwitchA-nqa-admin-test-icmp-echo] quit

# 启动探测。

[SwitchA] nqa schedule admin test start-time now lifetime forever

(3)     在Switch A上配置Track项

# 配置Track项1,关联NQA测试组(管理员为admin,操作标签为test)的联动项1。

[SwitchA] track 1 nqa entry admin test reaction 1

(4)     在Switch A上配置VRRP

# 在VLAN接口2下,配置VRRP适用版本为VRRPv2。

[SwitchA] interface vlan-interface 2

[SwitchA-Vlan-interface2] vrrp version 2

# 创建备份组1,并配置备份组1的虚拟IP地址为10.1.1.10。

[SwitchA-Vlan-interface2] vrrp vrid 1 virtual-ip 10.1.1.10

# 设置Switch A在备份组1中的优先级为110。

[SwitchA-Vlan-interface2] vrrp vrid 1 priority 110

# 设置备份组的认证方式为simple,认证字为hello。

[SwitchA-Vlan-interface2] vrrp vrid 1 authentication-mode simple plain hello

# 设置Master发送VRRP报文的间隔时间为500厘秒。

[SwitchA-Vlan-interface2] vrrp vrid 1 timer advertise 500

# 设置Switch A工作在抢占方式,抢占延迟时间为5000厘秒。

[SwitchA-Vlan-interface2] vrrp vrid 1 preempt-mode delay 5000

# 设置监视Track项。

[SwitchA-Vlan-interface2] vrrp vrid 1 track 1 priority reduced 30

(5)     在Switch B上配置VRRP

# 在VLAN接口2下,配置VRRP适用版本为VRRPv2。

<SwitchB> system-view

[SwitchB] interface vlan-interface 2

[SwitchB-Vlan-interface2] vrrp version 2

# 创建备份组1,并配置备份组1的虚拟IP地址为10.1.1.10。

[SwitchB-Vlan-interface2] vrrp vrid 1 virtual-ip 10.1.1.10

# 设置备份组的认证方式为simple,认证字为hello。

[SwitchB-Vlan-interface2] vrrp vrid 1 authentication-mode simple plain hello

# 设置Master发送VRRP报文的间隔时间为500厘秒。

[SwitchB-Vlan-interface2] vrrp vrid 1 timer advertise 500

# 设置Switch B工作在抢占方式,抢占延迟时间为5000厘秒。

[SwitchB-Vlan-interface2] vrrp vrid 1 preempt-mode delay 5000

4. 验证配置

配置完成后,在Host A上可以ping通Host B。通过display vrrp命令查看配置后的结果。

# 显示Switch A上备份组1的详细信息。

[SwitchA-Vlan-interface2] display vrrp verbose

IPv4 Virtual Router Information:

 Running Mode      : Standard

 Total number of virtual routers : 1

   Interface Vlan-interface2

     VRID           : 1               Adver Timer  : 500

     Admin Status   : Up              State        : Master

     Config Pri     : 110             Running Pri  : 110

     Preempt Mode   : Yes             Delay Time   : 5000

     Auth Type      : Simple          Key          : ******

     Virtual IP     : 10.1.1.10

     Virtual MAC    : 0000-5e00-0101

     Master IP      : 10.1.1.1

   VRRP Track Information:

     Track Object   : 1              State : Positive          Pri Reduced : 30

# 显示Switch B上备份组1的详细信息。

[SwitchB-Vlan-interface2] display vrrp verbose

IPv4 Virtual Router Information:

 Running Mode      : Standard

 Total number of virtual routers : 1

   Interface Vlan-interface2

     VRID           : 1               Adver Timer  : 500

     Admin Status   : Up              State        : Backup

     Config Pri     : 100             Running Pri  : 100

     Preempt Mode   : Yes             Delay Time   : 5000

     Become Master  : 2200ms left

     Auth Type      : Simple          Key          : ******

     Virtual IP     : 10.1.1.10

     Master IP      : 10.1.1.1

以上显示信息表示在备份组1中Switch A为Master,Switch B为Backup,Host A发送给Host B的报文通过Switch A转发。

Switch A与Switch C不通时,在Host A上仍然可以ping通Host B。通过display vrrp命令查看备份组的信息。

# Switch A与Switch C不通时,显示Switch A上备份组1的详细信息。

[SwitchA-Vlan-interface2] display vrrp verbose

IPv4 Virtual Router Information:

 Running Mode      : Standard

 Total number of virtual routers : 1

   Interface Vlan-interface2

     VRID           : 1               Adver Timer  : 500

     Admin Status   : Up              State        : Backup

     Config Pri     : 110             Running Pri  : 80

     Preempt Mode   : Yes             Delay Time   : 5000

     Become Master  : 2200ms left

     Auth Type      : Simple          Key          : ******

     Virtual IP     : 10.1.1.10

     Master IP      : 10.1.1.2

   VRRP Track Information:

     Track Object   : 1              State : Negative          Pri Reduced : 30

# Switch A与Switch C不通时,显示Switch B上备份组1的详细信息。

[SwitchB-Vlan-interface2] display vrrp verbose

IPv4 Virtual Router Information:

 Running Mode      : Standard

 Total number of virtual routers : 1

   Interface Vlan-interface2

     VRID           : 1               Adver Timer  : 500

     Admin Status   : Up              State        : Master

     Config Pri     : 100             Running Pri  : 100

     Preempt Mode   : Yes             Delay Time   : 5000

     Auth Type      : Simple          Key          : ******

     Virtual IP     : 10.1.1.10

     Virtual MAC    : 0000-5e00-0101

     Master IP      : 10.1.1.2

以上显示信息表示Switch A与Switch C不通时,Switch A的优先级降低为80,成为Backup,Switch B成为Master,Host A发送给Host B的报文通过Switch B转发。

原文地址:https://www.cnblogs.com/itfat/p/10298443.html