1. 组网需求

Device ADevice BDevice CDevice D连接了20.1.1.0/2430.1.1.0/24两个网段在设备上配置静态路由以实现两个网段的互通并配置路由备份以提高网络的可靠性。

Device A作为20.1.1.0/24网段内主机的缺省网关,在Device A上存在两条到达30.1.1.0/24网段的静态路由,下一跳分别为Device BDevice C。这两条静态路由形成备份,其中:

l              下一跳为Device B的静态路由优先级高,作为主路由。该路由可达时,Device A通过Device B将报文转发到30.1.1.0/24网段。

l              下一跳为Device C的静态路作为备份路由。

l              Device A上通过静态路由、TrackNQA联动,实时判断主路由是否可达。当主路由不可达时,备份路由生效,Device A通过Device C将报文转发到30.1.1.0/24网段。

同样地,Device D作为30.1.1.0/24网段内主机的缺省网关,在Device D上存在两条到达20.1.1.0/24网段的静态路由,下一跳分别为Device BDevice C。这两条静态路由形成备份,其中:

l              下一跳为Device B的静态路由优先级高,作为主路由。该路由可达时,Device D通过Device B将报文转发到20.1.1.0/24网段。

l              下一跳为Device C的静态路作为备份路由。

l              Device D上通过静态路由、TrackNQA联动,实时判断主路由是否可达。当主路由不可达时,备份路由生效,Device D通过Device C将报文转发到20.1.1.0/24网段。

2. 组网图

图1-2 静态路由、TrackNQA联动配置组网图

 

3. 配置步骤

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

(2)        配置Device A

# 配置到达30.1.1.0/24网段的静态路由:下一跳地址为10.1.1.2,优先级为缺省值60,该路由与Track1关联。

<DeviceA> system-view

[DeviceA] ip route-static 30.1.1.0 24 10.1.1.2 track 1

# 配置到达30.1.1.0/24网段的静态路由:下一跳地址为10.3.1.3,优先级为80

[DeviceA] ip route-static 30.1.1.0 24 10.3.1.3 preference 80

# 配置到达10.2.1.4的静态路由:下一跳地址为10.1.1.2

[DeviceA] ip route-static 10.2.1.4 24 10.1.1.2

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

[DeviceA] nqa entry admin test

# 配置测试类型为ICMP-echo

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

# 配置测试的目的地址为10.2.1.4,下一跳地址为10.1.1.2,以便通过NQA检测Device ADevice BDevice D这条路径的连通性。

[DeviceA-nqa-admin-test-icmp-echo] destination ip 10.2.1.4

[DeviceA-nqa-admin-test-icmp-echo] next-hop 10.1.1.2

# 配置测试频率为100ms

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

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

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

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

# 启动探测。

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

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

[DeviceA] track 1 nqa entry admin test reaction 1

(3)        配置Device B

# 配置到达30.1.1.0/24网段的静态路由:下一跳地址为10.2.1.4

<DeviceB> system-view

[DeviceB] ip route-static 30.1.1.0 24 10.2.1.4

# 配置到达20.1.1.0/24网段的静态路由:下一跳地址为10.1.1.1

[DeviceB] ip route-static 20.1.1.0 24 10.1.1.1

(4)        配置Device C

# 配置到达30.1.1.0/24网段的静态路由:下一跳地址为10.4.1.4

<DeviceC> system-view

[DeviceC] ip route-static 30.1.1.0 24 10.4.1.4

# 配置到达20.1.1.0/24网段的静态路由:下一跳地址为10.3.1.1

[DeviceC] ip route-static 20.1.1.0 24 10.3.1.1

(5)        配置Device D

# 配置到达20.1.1.0/24网段的静态路由:下一跳地址为10.2.1.2,优先级为缺省值60,该路由与Track1关联。

<DeviceD> system-view

[DeviceD] ip route-static 20.1.1.0 24 10.2.1.2 track 1

# 配置到达20.1.1.0/24网段的静态路由:下一跳地址为10.4.1.3,优先级为80

[DeviceD] ip route-static 20.1.1.0 24 10.4.1.3 preference 80

# 配置到达10.1.1.1的静态路由:下一跳地址为10.2.1.2

[DeviceD] ip route-static 10.1.1.1 24 10.2.1.2

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

[DeviceD] nqa entry admin test

# 配置测试类型为ICMP-echo

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

# 配置测试的目的地址为10.1.1.1,下一跳地址为10.2.1.2,以便通过NQA检测Device DDevice BDevice A这条路径的连通性。

[DeviceD-nqa-admin-test-icmp-echo] destination ip 10.1.1.1

[DeviceD-nqa-admin-test-icmp-echo] next-hop 10.2.1.2

# 配置测试频率为100ms

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

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

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

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

# 启动探测。

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

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

[DeviceD] track 1 nqa entry admin test reaction 1

(6)        验证配置结果

# 显示Device ATrack项的信息。

[DeviceA] display track all

Track ID: 1

  Status: Positive

  Duration: 0 days 0 hours 2 minutes 14 seconds

  Notification delay: Positive 0, Negative 0 (in seconds)

  Reference object:

    NQA entry: admin test

    Reaction: 1

# 显示Device A的路由表。

[DeviceA] display ip routing-table

Routing Tables: Public

         Destinations : 10       Routes : 10

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

10.1.1.0/24         Direct 0    0            10.1.1.1        Vlan2

10.1.1.1/32         Direct 0    0            127.0.0.1       InLoop0

10.2.1.0/24         Static 60   0            10.1.1.2        Vlan2

10.3.1.0/24         Direct 0    0            10.3.1.1        Vlan3

10.3.1.1/32         Direct 0    0            127.0.0.1       InLoop0

20.1.1.0/24         Direct 0    0            20.1.1.1        Vlan6

20.1.1.1/32         Direct 0    0            127.0.0.1       InLoop0

30.1.1.0/24         Static 60   0            10.1.1.2        Vlan2

127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0

127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0

以上显示信息表示,NQA测试的结果为主路由可达(Track项状态为Positive),Device A通过Device B将报文转发到30.1.1.0/24网段。

# Device B上删除VLAN接口2IP地址。

<DeviceB> system-view

[DeviceB] interface vlan-interface 2

[DeviceB-Vlan-interface2] undo ip address

# 显示Device ATrack项的信息。

[DeviceA] display track all

Track ID: 1

  Status: Negative

  Duration: 0 days 0 hours 1 minutes 13 seconds

  Notification delay: Positive 0, Negative 0 (in seconds)

  Reference object:

    NQA entry: admin test

    Reaction: 1

# 显示Device A的路由表。

[DeviceA] display ip routing-table

Routing Tables: Public

 

         Destinations : 10       Routes : 10

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

10.1.1.0/24         Direct 0    0            10.1.1.1        Vlan2

10.1.1.1/32         Direct 0    0            127.0.0.1       InLoop0

10.2.1.0/24         Static 60   0            10.1.1.2        Vlan2

10.3.1.0/24         Direct 0    0            10.3.1.1        Vlan3

10.3.1.1/32         Direct 0    0            127.0.0.1       InLoop0

20.1.1.0/24         Direct 0    0            20.1.1.1        Vlan6

20.1.1.1/32         Direct 0    0            127.0.0.1       InLoop0

30.1.1.0/24         Static 80   0            10.3.1.3        Vlan3

127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0

127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0

以上显示信息表示,NQA测试的结果为主路由不可达(Track项状态为Negative),则备份路由生效,Device A通过Device C将报文转发到30.1.1.0/24网段。

# 主路由出现故障后,20.1.1.0/24网段内的主机仍然可以与30.1.1.0/24网段内的主机通信。

[DeviceA] ping -a 20.1.1.1 30.1.1.1

  PING 30.1.1.1: 56  data bytes, press CTRL_C to break

    Reply from 30.1.1.1: bytes=56 Sequence=1 ttl=254 time=2 ms

    Reply from 30.1.1.1: bytes=56 Sequence=2 ttl=254 time=1 ms

    Reply from 30.1.1.1: bytes=56 Sequence=3 ttl=254 time=1 ms

    Reply from 30.1.1.1: bytes=56 Sequence=4 ttl=254 time=2 ms

    Reply from 30.1.1.1: bytes=56 Sequence=5 ttl=254 time=1 ms

  --- 30.1.1.1 ping statistics ---

    5 packet(s) transmitted

    5 packet(s) received

    0.00% packet loss

    round-trip min/avg/max = 1/1/2 ms

# Device D上的显示信息与Device A类似。主路由出现故障后,30.1.1.0/24网段内的主机仍然可以与20.1.1.0/24网段内的主机通信。

[DeviceB] ping -a 30.1.1.1 20.1.1.1

  PING 20.1.1.1: 56  data bytes, press CTRL_C to break

    Reply from 20.1.1.1: bytes=56 Sequence=1 ttl=254 time=2 ms

    Reply from 20.1.1.1: bytes=56 Sequence=2 ttl=254 time=1 ms

    Reply from 20.1.1.1: bytes=56 Sequence=3 ttl=254 time=1 ms

    Reply from 20.1.1.1: bytes=56 Sequence=4 ttl=254 time=1 ms

    Reply from 20.1.1.1: bytes=56 Sequence=5 ttl=254 time=1 ms

  --- 20.1.1.1 ping statistics ---

    5 packet(s) transmitted

    5 packet(s) received

    0.00% packet loss

    round-trip min/avg/max = 1/1/2 ms