通过实例分析理解浮动静态路由、路由负载分担

1、静态路由

  • 静态路由采用的 算法是:非自适应算法。
  • 非自适应算法:是指设备不会根据当前测量或者估计的流量和拓扑结构,来调整它们的路由决策。意味着依靠静态路由条目来转发数据包的路由设备更容易在这些路由条目指示的转发路径出现变更时,失去向该路由指明的网络转发数据包的能力。

   这就是目前所面临的问题,下面给出解决方案。

2、浮动静态路由和路由负载分担

路由负载分担:当一台路由器上有两条以不同路径去往同一个网络的等优先级静态路由时,路由器就会同时利用这两条链路来转发流量。

浮动静态路由:通过修改静态路由的优先级,使一条路由成为某条主用路由备份条目的路由称为浮动静态路由。

  • 静态路由:缺乏适应性。

  •    如果上面这条链路出现故障后,路由器AR1不会利用下面的链路转发转发网络数据包到目的地。
  •    解决问题:管理员在AR1上配置下,配置完成后,AR1会先选择上面的路由转发数据包、如果不可以用,会选择下面的链路转发数据包。

3、浮动静态路由配置

 

(1)设备拓扑结构连接

(2)查看AR1路由表和静态路由

  • 在AR1上配置静态浮动路由
[AR1]ip route-static 10.0.84.0 24 serial 0/0/0 192.168.12.1
[AR1]ip route-static 10.0.84.0 24 serial 0/0/1 192.168.21.1 preference 70
  • 查看AR1路由表
[AR1]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 11       Routes : 11       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

      10.0.83.0/24  Direct  0    0           D   10.0.83.2       GigabitEthernet
0/0/0
      10.0.83.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
      10.0.84.0/24  Static  60   0           D   192.168.12.1    Serial0/0/0
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
   192.168.12.0/30  Direct  0    0           D   192.168.12.2    Serial0/0/0
   192.168.12.1/32  Direct  0    0           D   192.168.12.1    Serial0/0/0
   192.168.12.2/32  Direct  0    0           D   127.0.0.1       Serial0/0/0
   192.168.21.0/30  Direct  0    0           D   192.168.21.2    Serial0/0/1
   192.168.21.1/32  Direct  0    0           D   192.168.21.1    Serial0/0/1
   192.168.21.2/32  Direct  0    0           D   127.0.0.1       Serial0/0/1

  可以看出路由条目表中只有:

10.0.84.0/24  Static  60   0           D   192.168.12.1    Serial0/0/0
  • 查看静态路由
[AR1]display ip routing-table protocol static
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : Static
         Destinations : 1        Routes : 2        Configured Routes : 2

Static routing table status : <Active>
         Destinations : 1        Routes : 1

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

      10.0.84.0/24  Static  60   0           D   192.168.12.1    Serial0/0/0

Static routing table status : <Inactive>
         Destinations : 1        Routes : 1

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

      10.0.84.0/24  Static  70   0               192.168.21.1    Serial0/0/1

  • <Active>:显示的路由是路由器当前正在使用的路由。
  • <Inactive>:这条路由没有启用,也没有装入FIB表。
  • 关闭AR2的s0/0/0接口,查看AR1路由变化(注意变化)

    断开接口:

<AR2>sy
Enter system view, return user view with Ctrl+Z.
[AR2]interface s0/0/0
[AR2-Serial0/0/0]shutdown
Apr 20 2020 12:29:02-08:00 AR2 %%01PHY/1/PHY(l)[0]:    Serial0/0/0: change statu
s to down

   查看AR1路由表:

[AR1]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 8        Routes : 8        

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

      10.0.83.0/24  Direct  0    0           D   10.0.83.2       GigabitEthernet
0/0/0
      10.0.83.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
      10.0.84.0/24  Static  70   0           D   192.168.21.1    Serial0/0/1
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
   192.168.21.0/30  Direct  0    0           D   192.168.21.2    Serial0/0/1
   192.168.21.1/32  Direct  0    0           D   192.168.21.1    Serial0/0/1
   192.168.21.2/32  Direct  0    0           D   127.0.0.1       Serial0/0/1
[AR1]display ip routing-table protocol static
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : Static
         Destinations : 1        Routes : 1        Configured Routes : 2

Static routing table status : <Active>
         Destinations : 1        Routes : 1

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

      10.0.84.0/24  Static  70   0           D   192.168.21.1    Serial0/0/1

Static routing table status : <Inactive>
         Destinations : 0        Routes : 0

 从这可以看出:现在活跃的路由经过s0/0/1,路由优先级为70的备用路由,之前的主路由已经被移除。

  • 重启AR2的s0/0/0接口,再查看AR1路由表(注意变化)

    启用AR2的s0/0/0接口:

[AR2]interface s0/0/0
[AR2-Serial0/0/0]undo shutdown

    再次查看AR1路由表:

[AR1]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 11       Routes : 11       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

      10.0.83.0/24  Direct  0    0           D   10.0.83.2       GigabitEthernet
0/0/0
      10.0.83.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
      10.0.84.0/24  Static  60   0           D   192.168.12.1    Serial0/0/0
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
   192.168.12.0/30  Direct  0    0           D   192.168.12.2    Serial0/0/0
   192.168.12.1/32  Direct  0    0           D   192.168.12.1    Serial0/0/0
   192.168.12.2/32  Direct  0    0           D   127.0.0.1       Serial0/0/0
   192.168.21.0/30  Direct  0    0           D   192.168.21.2    Serial0/0/1
   192.168.21.1/32  Direct  0    0           D   192.168.21.1    Serial0/0/1
   192.168.21.2/32  Direct  0    0           D   127.0.0.1       Serial0/0/1
[AR1]display ip routing-table protocol static
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : Static
         Destinations : 1        Routes : 2        Configured Routes : 2

Static routing table status : <Active>
         Destinations : 1        Routes : 1

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

      10.0.84.0/24  Static  60   0           D   192.168.12.1    Serial0/0/0

Static routing table status : <Inactive>
         Destinations : 1        Routes : 1

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

      10.0.84.0/24  Static  70   0               192.168.21.1    Serial0/0/1

  s0/0/0中的主用路由再次出现在AR1路由条目表中,网络恢复为初始状态。

4、路由负载分担配置

  • 在上述例题:AR2上配置两条目的地相同、优先级也相同的路由。
[AR2]ip route-static 10.0.83.0 24 serial 0/0/0 192.168.12.2
[AR2]ip route-static 10.0.83.0 24 serial 0/0/0 192.168.21.2
  • 查看AR2路由表
[AR2]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 11       Routes : 12       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

      10.0.83.0/24  Static  60   0           D   192.168.21.2    Serial0/0/0
                    Static  60   0           D   192.168.12.2    Serial0/0/0
      10.0.84.0/24  Direct  0    0           D   10.0.84.2       GigabitEthernet
0/0/0
      10.0.84.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
   192.168.12.0/30  Direct  0    0           D   192.168.12.1    Serial0/0/0
   192.168.12.1/32  Direct  0    0           D   127.0.0.1       Serial0/0/0
   192.168.12.2/32  Direct  0    0           D   192.168.12.2    Serial0/0/0
   192.168.21.0/30  Direct  0    0           D   192.168.21.1    Serial0/0/1
   192.168.21.1/32  Direct  0    0           D   127.0.0.1       Serial0/0/1
   192.168.21.2/32  Direct  0    0           D   192.168.21.2    Serial0/0/1

[AR2]display ip routing-table protocol static
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : Static
         Destinations : 1        Routes : 2        Configured Routes : 2

Static routing table status : <Active>
         Destinations : 1        Routes : 2

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

      10.0.83.0/24  Static  60   0           D   192.168.21.2    Serial0/0/0
                    Static  60   0           D   192.168.12.2    Serial0/0/0

Static routing table status : <Inactive>
         Destinations : 0        Routes : 0

  配置时候都用了默认的优先级值,静态路由能够实现链路备份,也能够实现负载均衡。

猜你喜欢

转载自blog.csdn.net/fanjufei123456/article/details/105627503