通過實例分析理解浮動靜態路由、路由負載分擔

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

  配置時候都用了默認的優先級值,靜態路由能夠實現鏈路備份,也能夠實現負載均衡。

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章