02-靜態路由配置
本章節下載: 02-靜態路由配置 (482.07 KB)
目 錄
靜態路由是一種特殊的路由,由管理員手工配置。當網絡結構比較簡單時,隻需配置靜態路由就可以使網絡正常工作。
靜態路由不能自動適應網絡拓撲結構的變化。當網絡發生故障或者拓撲發生變化後,必須由網絡管理員手工修改配置。
在配置靜態路由之前,需完成以下任務:
· 配置相關接口的物理參數
· 配置相關接口的鏈路層屬性
· 配置相關接口的IP地址
配置不指定下一跳地址、隻指定VPN實例的靜態路由時,還需要配置業務環回組功能該靜態路由才能生效。配置的方法如下:
(1) 創建跨VPN轉發類型的業務環回組。
(2) 將任意二層以太網接口加入該業務環回組。如下單板上的接口除外,否則該靜態路由無法正常指導報文轉發。
¡ SA係列接口板
¡ SC係列接口板
有關業務環回組創建和配置的詳細介紹,請參見“二層技術-以太網交換配置指導”中的“業務環回組”。
操作 |
命令 |
說明 |
進入係統視圖 |
system-view |
- |
配置靜態路由 |
ip route-static dest-address { mask-length | mask } interface-type interface-number [ next-hop-address [ nexthop-index index-string ] ][ permanent | track track-entry-number ] [ preference preference ] [ tag tag-value ] [ recursive-lookup ] [ description text ] ip route-static dest-address { mask-length | mask } { next-hop-address [ nexthop-index index-string ] [ recursive-lookup host-route ] | vpn-instance d-vpn-instance-name
next-hop-address [ nexthop-index index-string
] [ recursive-lookup host-route ] } [ permanent | track track-entry-number ] [ preference
preference ] [ tag tag-value ] [ recursive-lookup ] [ description text ] ip route-static dest-address { mask-length | mask } interface-type interface-number next-hop-address [ nexthop-index index-string ] track-arp [ preference preference ] [ tag tag-value ] [ description text ] |
二者選其一 缺省情況下,未配置靜態路由
|
ip route-static vpn-instance s-vpn-instance-name dest-address { mask-length | mask } interface-type interface-number [ next-hop-address [ nexthop-index index-string ] ] [ permanent | track track-entry-number ] [ preference preference ] [ tag tag-value ] [ recursive-lookup ] [ description text ] ip route-static vpn-instance s-vpn-instance-name dest-address { mask-length | mask } { next-hop-address [ nexthop-index index-string ] [ recursive-lookup host-route ] [ public ] | vpn-instance d-vpn-instance-name next-hop-address [ nexthop-index index-string ] [ recursive-lookup host-route ] } [ permanent | track track-entry-number ] [ preference preference ] [ tag tag-value ] [ recursive-lookup ] [ description text ] ip route-static vpn-instance s-vpn-instance-name dest-address { mask-length | mask } { public | vpn-instance d-vpn-instance-name } [ track track-entry-number ] [ preference preference ] [ tag tag-value ] [ description text ] ip route-static vpn-instance s-vpn-instance-name dest-address { mask-length | mask } interface-type interface-number next-hop-address [ nexthop-index index-string ] track-arp [ preference preference ] [ tag tag-value ] [ description text ] |
||
(可選)配置靜態路由向下一跳定時發送ARP request |
ip route-static arp-request interval interval |
缺省情況下,靜態路由不發送ARP request |
(可選)配置靜態路由的缺省優先級 |
ip route-static default-preference default-preference |
缺省情況下,靜態路由的缺省優先級為60 |
(可選)刪除所有靜態路由 |
delete [ vpn-instance vpn-instance-name ] static-routes all |
- |
· 通過在Track模塊和靜態路由之間建立聯動,可以實現實時監測下一跳的可達性,以便及時判斷靜態路由是否有效。關於Track的詳細介紹,請參見“可靠性配置指導”中的“Track”。
· 參數recursive-lookup host-route和recursive-lookup互斥,不能同時配置。
· 使用undo ip route-static命令可以刪除一條靜態路由,而使用delete static-routes all命令可以刪除包括缺省路由在內的所有靜態路由。
· 如果指定目的VPN實例,但未指定next-hop-address參數,則目的VPN實例和源VPN實例不能相同。
當配置多條靜態路由時,如果隻是前綴不同,每條靜態路由都要配置一遍命令,比較繁瑣。可以配置靜態路由配置組,對靜態路由進行批量配置,節省配置工作量。
按配置組配置靜態路由時,配置組下的所有前綴會應用相同的下一跳、出接口信息。
配置不指定下一跳地址、隻指定VPN實例的靜態路由時,還需要配置業務環回組功能該靜態路由才能生效。配置的方法如下:
(1) 創建跨VPN轉發類型的業務環回組。
(2) 將任意二層以太網接口加入該業務環回組。如下單板上的接口除外,否則該靜態路由無法正常指導報文轉發。
¡ SA係列接口板
¡ SC係列接口板
有關業務環回組創建和配置的詳細介紹,請參見“二層技術-以太網交換配置指導”中的“業務環回組”。
表1-2 配置靜態路由組
操作 |
命令 |
說明 |
進入係統視圖 |
system-view |
- |
創建靜態路由配置組,並進入靜態路由配置組視圖 |
ip route-static-group group-name |
缺省情況下,未配置靜態路由配置組 |
在靜態路由配置組中增加前綴 |
prefix dest-address { mask-length | mask } |
缺省情況下,靜態路由配置組中未配置前綴 |
退回係統視圖 |
quit |
- |
配置靜態路由 |
ip route-static group group-name interface-type interface-number [ next-hop-address ] [ permanent | track track-entry-number ] [ preference preference ] [ tag tag-value ] [ recursive-lookup ] [ description text ] ip route-static group group-name { next-hop-address [ recursive-lookup host-route ] | vpn-instance d-vpn-instance-name next-hop-address [ recursive-lookup host-route ] } [ permanent | track track-entry-number ] [ preference preference ] [ tag tag-value ] [ recursive-lookup ] [ description text ] ip route-static group group-name vpn-instance d-vpn-instance-name [ track track-entry-number ] [ preference preference ] [ tag tag-value ] [ description text ] ip route-static group group-name interface-type interface-number next-hop-address track-arp [ preference preference ] [ tag tag-value ] [ description text ] |
二者選其一 缺省情況下,未配置靜態路由 |
ip route-static vpn-instance s-vpn-instance-name group group-name interface-type interface-number [ next-hop-address ] [ permanent | track track-entry-number ] [ preference preference ] [ tag tag-value ] [ recursive-lookup ] [ description text ] ip route-static vpn-instance s-vpn-instance-name group group-name { next-hop-address [ recursive-lookup host-route ] [ public ] | vpn-instance d-vpn-instance-name next-hop-address [ recursive-lookup host-route ] } [ permanent | track track-entry-number ] [ preference preference ] [ tag tag-value ] [ recursive-lookup ] [ description text ] ip route-static vpn-instance s-vpn-instance-name group group-name { public | vpn-instance d-vpn-instance-name } [ track track-entry-number ] [ preference preference ] [ tag tag-value ] [ description text ] ip route-static vpn-instance s-vpn-instance-name group group-name interface-type interface-number next-hop-address track-arp [ preference preference ] [ tag tag-value ] [ description text ] |
||
(可選)配置靜態路由向下一跳定時發送ARP request |
ip route-static arp-request interval interval |
缺省情況下,靜態路由不發送ARP request |
(可選)配置靜態路由的缺省優先級 |
ip route-static default-preference default-preference |
缺省情況下,靜態路由的缺省優先級為60 |
(可選)刪除所有靜態路由 |
delete [ vpn-instance vpn-instance-name ] static-routes all |
- |
· 通過在Track模塊和靜態路由之間建立聯動,可以實現實時監測下一跳的可達性,以便及時判斷靜態路由是否有效。關於Track的詳細介紹,請參見“可靠性配置指導”中的“Track”。
· 參數recursive-lookup host-route和recursive-lookup互斥,不能同時配置。
· 使用undo ip route-static命令可以刪除一條靜態路由,而使用delete static-routes all命令可以刪除包括缺省路由在內的所有靜態路由。
· 如果指定目的VPN實例,但未指定next-hop-address參數,則目的VPN實例和源VPN實例不能相同。
配置浮動靜態路由可以實現路由備份,提高網絡可靠性。
如果設備上已存在去往某一目的地址的靜態或動態路由,則再配置一條低優先級的靜態路由可以起到路由備份的作用,從而提高網絡可靠性。這條優先級較低的靜態路由稱為浮動靜態路由,隻有當主路由不可用時該靜態路由才會被激活,承擔數據轉發業務,在主路由恢複正常後,該靜態路由又變為不活躍狀態,數據轉發業務仍然由主路由承擔。
浮動靜態路由有如下兩種配置方式:
· 為目的地址相同的多條靜態路由指定不同的優先級,則低優先級的靜態路由自動成為備份路由。
· 如果設備上已存在去往某一目的地址的路由,則可以再配置一條低優先級的靜態路由。
在配置浮動靜態路由時,該路由優先級的值需大於主用路由優先級的值,具體的配置步驟請參見“1.2 配置靜態路由”。
路由震蕩時,使能BFD功能可能會加劇震蕩,請謹慎使用。
BFD(Bidirectional Forwarding Detection,雙向轉發檢測)提供了一個通用的、標準化的、介質無關、協議無關的快速故障檢測機製,可以為上層協議(如路由協議、MPLS等)統一地快速檢測兩台路由器間雙向轉發路徑的故障。
關於BFD的詳細介紹,請參見“可靠性配置指導”中的“BFD”。
通過控製報文檢測兩個方向上的鏈路狀態,實現毫秒級別的鏈路故障檢測。
控製報文方式的BFD檢測支持直連下一跳和非直連下一跳。
本端配置控製報文方式的BFD檢測時,需要對端也配置控製報文方式的BFD檢測。
直連下一跳是指下一跳和本端是直連的,配置時必須指定出接口和下一跳。
操作 |
命令 |
說明 |
進入係統視圖 |
system-view |
- |
配置靜態路由與BFD聯動 |
ip route-static dest-address { mask-length | mask } interface-type interface-number next-hop-address bfd control-packet [ preference preference ] [ tag tag-value ] [ description text ] |
二者選其一 缺省情況下,未配置靜態路由與BFD聯動 |
ip route-static vpn-instance s-vpn-instance-name dest-address { mask-length | mask } interface-type interface-number next-hop-address bfd control-packet [ preference preference ] [ tag tag-value ] [ description text ] |
非直連下一跳是指下一跳和本端不是直連的,中間還有其它設備。配置時必須指定下一跳和BFD源IP地址。
表1-4 配置靜態路由與BFD聯動(非直連下一跳BFD檢測)
操作 |
命令 |
說明 |
進入係統視圖 |
system-view |
- |
配置靜態路由與BFD聯動 |
ip route-static dest-address { mask-length | mask } { next-hop-address bfd control-packet bfd-source ip-address | vpn-instance d-vpn-instance-name next-hop-address bfd control-packet bfd-source ip-address } [ preference preference ] [ tag tag-value ] [ description text ] |
二者選其一 缺省情況下,未配置靜態路由與BFD聯動 |
ip route-static vpn-instance s-vpn-instance-name dest-address { mask-length | mask } { next-hop-address bfd control-packet bfd-source ip-address | vpn-instance d-vpn-instance-name next-hop-address bfd control-packet bfd-source ip-address } [ preference preference ] [ tag tag-value ] [ description text ] |
通過echo報文方式的BFD檢測鏈路的狀態時,echo報文的目的地址為本端接口地址,發送給下一跳設備後會直接轉發回本端。
隻需要在本端配置echo報文方式的BFD檢測。
靜態路由的出接口處於SPOOFING狀態時,不能使用BFD進行檢測。
表1-5 配置靜態路由與BFD聯動(echo報文方式的BFD檢測)
操作 |
命令 |
說明 |
進入係統視圖 |
system-view |
- |
配置echo報文的源IP地址 |
bfd echo-source-ip ip-address |
缺省情況下,未配置echo報文的源IP地址 本命令的詳細情況請參見“可靠性命令參考”中的“BFD” 為了避免對端發送大量的ICMP重定向報文造成網絡擁塞,建議配置的源IP地址不屬於該設備任何一個接口所在網段 |
配置靜態路由與BFD聯動 |
ip route-static dest-address { mask-length | mask } interface-type interface-number next-hop-address bfd echo-packet [ preference preference ] [ tag tag-value ] [ description text ] |
二者選其一 缺省情況下,未配置靜態路由與BFD聯動 |
ip route-static vpn-instance s-vpn-instance-name dest-address { mask-length | mask } interface-type interface-number next-hop-address bfd echo-packet [ preference preference ] [ tag tag-value ] [ description text ] |
當網絡中的鏈路或某台路由器發生故障時,需要通過故障鏈路或故障路由器傳輸才能到達目的地的報文將會丟失,數據流量將會被中斷。
為了盡可能避免網絡故障導致的流量中斷,網絡管理員可以根據需要配置靜態路由快速重路由功能。
如圖1-1所示,通過配置快速重路由功能,網絡管理員可以為路由指定備份下一跳,也可以在存在低優先級靜態路由的情況下,使能自動快速重路由功能,查找滿足條件的低優先級路由的下一跳作為主路由的備份下一跳,當路由器檢測到網絡故障時,路由器會使用事先配置好的備份下一跳替換失效下一跳,通過備份下一跳來指導報文的轉發,從而避免了流量中斷。
靜態路由快速重路由功能不能與靜態路由BFD功能同時使用。
等價路由不支持配置靜態路由快速重路由功能。
配置本功能後,當主鏈路三層接口up,主鏈路由雙通變為單通或者不通時,設備會將流量快速地切換到備份路徑上轉發;當主鏈路三層接口down時,設備會暫時將流量快速地切換到備份路徑上轉發。同時,設備會重新查找到達目的地址的路由,並將流量切換到查找到的新的路徑。如果沒有查找到路由,則流量轉發會中斷。因此,除本配置創建的靜態路由外,設備上還需要存在一條到達目的地址的路由。單通現象,即一條鏈路上的兩端,有且隻有一端可以收到另一端發來的報文,此鏈路稱為單向鏈路。
(1) 配置靜態路由快速重路由功能(手工指定備份下一跳)
表1-6 配置靜態路由快速重路由功能(手工指定備份下一跳)
操作 |
命令 |
說明 |
進入係統視圖 |
system-view |
- |
配置靜態路由快速重路由功能 |
ip route-static dest-address { mask-length | mask } interface-type interface-number [ next-hop-address [ backup-interface interface-type interface-number [ backup-nexthop backup-nexthop-address ] ] ] [ permanent ] [ preference preference ] [ tag tag-value ] [ description text ] |
二者選其一 缺省情況下,靜態路由快速重路由功能處於關閉狀態 |
ip route-static vpn-instance s-vpn-instance-name dest-address { mask-length | mask } interface-type interface-number [ next-hop-address [ backup-interface interface-type interface-number [ backup-nexthop backup-nexthop-address ] ] ] [ permanent ] [ preference preference ] [ tag tag-value ] [ description text ] |
· 靜態路由配置的備份出接口拔出或者刪除時,配置的路由會失效。
· 備份出接口和下一跳不能直接修改,且不能和主出接口和下一跳相同。
(2) 配置靜態路由快速重路由功能(自動查找備份下一跳)
表1-7 配置靜態路由快速重路由功能(自動查找備份下一跳)
操作 |
命令 |
說明 |
進入係統視圖 |
system-view |
- |
配置靜態路由自動快速重路由功能 |
ip route-static fast-reroute auto |
缺省情況下,靜態路由自動快速重路由功能處於關閉狀態 |
缺省情況下,靜態路由通過ARP檢測主路由的下一跳是否可達。配置本功能後,將使用BFD(Echo方式)檢測主路由的下一跳是否可達,這種方式可以更快地檢測到鏈路故障。
表1-8 配置靜態路由快速重路由支持BFD檢測功能
操作 |
命令 |
說明 |
進入係統視圖 |
system-view |
- |
配置BFD Echo報文源地址 |
bfd echo-source-ip ip-address |
缺省情況下,未配置BFD Echo報文源地址 echo報文的源IP地址用戶可以任意指定。為了避免對端發送大量的ICMP重定向報文造成網絡擁塞,建議配置echo報文的源IP地址不屬於該設備任何一個接口所在網段 本命令的詳細情況請參見“可靠性命令參考”中的“BFD” |
使能靜態路由中主用鏈路的BFD(Echo方式)檢測功能 |
ip route-static primary-path-detect bfd echo |
缺省情況下,靜態路由中主用鏈路的BFD(Echo方式)檢測功能處於關閉狀態 |
在完成上述配置後,在任意視圖下執行display命令查看靜態路由配置的運行情況並檢驗配置結果。
表1-9 靜態路由顯示和維護
操作 |
命令 |
查看靜態路由表信息(本命令的詳細情況請參見“三層技術-IP路由命令參考”中的“IP路由基礎”) |
display ip routing-table protocol static [ inactive | verbose ] |
顯示靜態路由下一跳信息 |
display route-static nib [ nib-id ] [ verbose ] |
顯示靜態路由表信息 |
display route-static routing-table [ vpn-instance vpn-instance-name ] [ ip-address { mask-length | mask } ] |
交換機各接口及主機的IP地址和掩碼如圖1-2所示。要求采用靜態路由,使圖中任意兩台主機之間都能互通。
(1) 配置各接口的IP地址(略)
(2) 配置靜態路由
# 在Switch A上配置缺省路由。
<SwitchA> system-view
[SwitchA] ip route-static 0.0.0.0 0.0.0.0 1.1.4.2
# 在Switch B上配置兩條靜態路由。
<SwitchB> system-view
[SwitchB] ip route-static 1.1.2.0 255.255.255.0 1.1.4.1
[SwitchB] ip route-static 1.1.3.0 255.255.255.0 1.1.5.6
# 在Switch C上配置缺省路由。
<SwitchC> system-view
[SwitchC] ip route-static 0.0.0.0 0.0.0.0 1.1.5.5
(3) 配置主機
配置Host A的缺省網關為1.1.2.3,Host B的缺省網關為1.1.6.1,Host C的缺省網關為1.1.3.1,具體配置過程略。
# 查看Switch A的靜態路由信息。
[SwitchA] display ip routing-table protocol static
Summary count : 1
Static Routing table status : <Active>
Summary count : 1
Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/0 Static 60 0 1.1.4.2 Vlan500
Static Routing table status : <Inactive>
Summary count : 0
# 查看Switch B的靜態路由信息。
[SwitchB] display ip routing-table protocol static
Summary count : 2
Static Routing table status : <Active>
Summary count : 2
Destination/Mask Proto Pre Cost NextHop Interface
1.1.2.0/24 Static 60 0 1.1.4.1 Vlan500
1.1.3.0/24 Static 60 0 1.1.5.6 Vlan600
Static Routing table status : <Inactive>
Summary count : 0
# 在Host B上使用ping命令驗證Host A是否可達(假定主機安裝的操作係統為Windows XP)。
C:\Documents and Settings\Administrator>ping 1.1.2.2
Pinging 1.1.2.2 with 32 bytes of data:
Reply from 1.1.2.2: bytes=32 time=1ms TTL=126
Reply from 1.1.2.2: bytes=32 time=1ms TTL=126
Reply from 1.1.2.2: bytes=32 time=1ms TTL=126
Reply from 1.1.2.2: bytes=32 time=1ms TTL=126
Ping statistics for 1.1.2.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 1ms, Average = 1ms
# 在Host B上使用tracert命令驗證Host A是否可達。
C:\Documents and Settings\Administrator>tracert 1.1.2.2
Tracing route to 1.1.2.2 over a maximum of 30 hops
1 <1 ms <1 ms <1 ms 1.1.6.1
2 <1 ms <1 ms <1 ms 1.1.4.1
3 1 ms <1 ms <1 ms 1.1.2.2
Trace complete.
· 在Switch A上配置靜態路由可以到達120.1.1.0/24網段,在Switch B上配置靜態路由可以到達121.1.1.0/24網段,並都使能BFD檢測功能。
· 在Switch C上配置靜態路由可以到達120.1.1.0/24網段和121.1.1.0/24網段。
· 當Switch A和Switch B通過L2 Switch通信的鏈路出現故障時,BFD能夠快速感知,並且切換到Switch C進行通信。
圖1-3 靜態路由與BFD聯動(直連)配置組網圖
設備 |
接口 |
IP地址 |
設備 |
接口 |
IP地址 |
Switch A |
Vlan-int10 |
12.1.1.1/24 |
Switch B |
Vlan-int10 |
12.1.1.2/24 |
|
Vlan-int11 |
10.1.1.102/24 |
|
Vlan-int13 |
13.1.1.1/24 |
Switch C |
Vlan-int11 |
10.1.1.100/24 |
|
|
|
|
Vlan-int13 |
13.1.1.2/24 |
|
|
|
(1) 配置各接口的IP地址(略)
(2) 配置靜態路由和BFD
# 在Switch A上配置靜態路由,並使能BFD檢測功能,使用控製報文檢測方式。
<SwitchA> system-view
[SwitchA] interface vlan-interface 10
[SwitchA-vlan-interface10] bfd min-transmit-interval 500
[SwitchA-vlan-interface10] bfd min-receive-interval 500
[SwitchA-vlan-interface10] bfd detect-multiplier 9
[SwitchA-vlan-interface10] quit
[SwitchA] ip route-static 120.1.1.0 24 vlan-interface 10 12.1.1.2 bfd control-packet
[SwitchA] ip route-static 120.1.1.0 24 vlan-interface 11 10.1.1.100 preference 65
[SwitchA] quit
# 在Switch B上配置靜態路由,並使能BFD檢測功能,使用控製報文檢測方式。
<SwitchB> system-view
[SwitchB] interface vlan-interface 10
[SwitchB-vlan-interface10] bfd min-transmit-interval 500
[SwitchB-vlan-interface10] bfd min-receive-interval 500
[SwitchB-vlan-interface10] bfd detect-multiplier 9
[SwitchB-vlan-interface10] quit
[SwitchB] ip route-static 121.1.1.0 24 vlan-interface 10 12.1.1.1 bfd control-packet
[SwitchB] ip route-static 121.1.1.0 24 vlan-interface 13 13.1.1.2 preference 65
[SwitchB] quit
# 在Switch C上配置靜態路由。
<SwitchC> system-view
[SwitchC] ip route-static 120.1.1.0 24 13.1.1.1
[SwitchC] ip route-static 121.1.1.0 24 10.1.1.102
下麵以Switch A為例,Switch B和Switch A類似,不再贅述。
# 查看BFD會話,可以看到BFD會話已經創建。
<SwitchA> display bfd session
Total sessions: 1 Up sessions: 1 Init mode: Active
IPv4 session working in control packet mode:
LD/RD SourceAddr DestAddr State Holdtime Interface
4/7 12.1.1.1 12.1.1.2 Up 2000ms Vlan10
# 查看靜態路由,可以看到Switch A經過L2 Switch到達Switch B。
<SwitchA> display ip routing-table protocol static
Summary count : 1
Static Routing table status : <Active>
Summary count : 1
Destination/Mask Proto Pre Cost NextHop Interface
120.1.1.0/24 Static 60 0 12.1.1.2 Vlan10
Static Routing table status : <Inactive>
Summary count : 0
當Switch A和Switch B通過L2 Switch通信的鏈路出現故障時:
# 查看靜態路由,可以看到Switch A經過Switch C到達Switch B。
<SwitchA> display ip routing-table protocol static
Summary count : 1
Static Routing table status : <Active>
Summary count : 1
Destination/Mask Proto Pre Cost NextHop Interface
120.1.1.0/24 Static 65 0 10.1.1.100 Vlan11
Static Routing table status : <Inactive>
Summary count : 0
· 在Switch A上配置靜態路由可以到達120.1.1.0/24網段,在Switch B上配置靜態路由可以到達121.1.1.0/24網段,並都使能BFD檢測功能。
· 在Switch C和Switch D上配置靜態路由可以到達120.1.1.0/24網段和121.1.1.0/24網段。
· Switch A存在到Switch B的接口Loopback1(2.2.2.9/32)的路由,出接口為Vlan-interface10;Switch B存在到Switch A的接口Loopback1(1.1.1.9/32)的路由,出接口為Vlan-interface12;Switch D存在到1.1.1.9/32的路由,出接口為Vlan-interface10,存在到2.2.2.9/32的路由,出接口為Vlan-interface12。
· 當Switch A和Switch B通過Switch D通信的鏈路出現故障時,BFD能夠快速感知,並且切換到Switch C進行通信。
圖1-4 靜態路由與BFD聯動(非直連)配置組網圖
設備 |
接口 |
IP地址 |
設備 |
接口 |
IP地址 |
Switch A |
Vlan-int10 |
12.1.1.1/24 |
Switch B |
Vlan-int12 |
11.1.1.1/24 |
|
Vlan-int11 |
10.1.1.102/24 |
|
Vlan-int13 |
13.1.1.1/24 |
|
Loop1 |
1.1.1.9/32 |
|
Loop1 |
2.2.2.9/32 |
Switch C |
Vlan-int11 |
10.1.1.100/24 |
Switch D |
Vlan-int10 |
12.1.1.2/24 |
|
Vlan-int13 |
13.1.1.2/24 |
|
Vlan-int12 |
11.1.1.2/24 |
(1) 配置各接口的IP地址(略)
(2) 配置靜態路由和BFD
# 在Switch A上配置靜態路由,並使能BFD檢測功能,使用控製報文檢測方式。
<SwitchA> system-view
[SwitchA] bfd multi-hop min-transmit-interval 500
[SwitchA] bfd multi-hop min-receive-interval 500
[SwitchA] bfd multi-hop detect-multiplier 9
[SwitchA] ip route-static 120.1.1.0 24 2.2.2.9 bfd control-packet bfd-source 1.1.1.9
[SwitchA] ip route-static 120.1.1.0 24 vlan-interface 11 10.1.1.100 preference 65
[SwitchA] quit
# 在Switch B上配置靜態路由,並使能BFD檢測功能,使用控製報文檢測方式。
<SwitchB> system-view
[SwitchB] bfd multi-hop min-transmit-interval 500
[SwitchB] bfd multi-hop min-receive-interval 500
[SwitchB] bfd multi-hop detect-multiplier 9
[SwitchB] ip route-static 121.1.1.0 24 1.1.1.9 bfd control-packet bfd-source 2.2.2.9
[SwitchB] ip route-static 121.1.1.0 24 vlan-interface 13 13.1.1.2 preference 65
[SwitchB] quit
# 在Switch C上配置靜態路由。
<SwitchC> system-view
[SwitchC] ip route-static 120.1.1.0 24 13.1.1.1
[SwitchC] ip route-static 121.1.1.0 24 10.1.1.102
# 在Switch D上配置靜態路由。
<SwitchD> system-view
[SwitchD] ip route-static 120.1.1.0 24 11.1.1.1
[SwitchD] ip route-static 121.1.1.0 24 12.1.1.1
下麵以Switch A為例,Switch B和Switch A類似,不再贅述。
# 查看BFD會話,可以看到BFD會話已經創建。
<SwitchA> display bfd session
Total sessions: 1 Up sessions: 1 Init mode: Active
IPv4 session working in control packet mode:
LD/RD SourceAddr DestAddr State Holdtime Interface
4/7 1.1.1.9 2.2.2.9 Up 2000ms N/A
# 查看靜態路由,可以看到Switch A經過Switch D到達Switch B。
<SwitchA> display ip routing-table protocol static
Summary count : 1
Static Routing table status : <Active>
Summary count : 1
Destination/Mask Proto Pre Cost NextHop Interface
120.1.1.0/24 Static 60 0 12.1.1.2 Vlan10
Static Routing table status : <Inactive>
Summary count : 0
當Switch A和Switch B通過Switch D通信的鏈路出現故障時:
# 查看靜態路由,可以看到Switch A經過Switch C到達Switch B。
<SwitchA> display ip routing-table protocol static
Summary count : 1
Static Routing table status : <Active>
Summary count : 1
Destination/Mask Proto Pre Cost NextHop Interface
120.1.1.0/24 Static 65 0 10.1.1.100 Vlan11
Static Routing table status : <Inactive>
Summary count : 0
如圖1-5所示,Switch A、Switch B和Switch C通過靜態路由實現網絡互連。要求當Switch A和Switch B之間的鏈路A出現單通故障時,業務可以快速切換到鏈路B上。
設備 |
接口 |
IP地址 |
設備 |
接口 |
IP地址 |
Switch A |
Vlan-int100 |
12.12.12.1/24 |
Switch B |
Vlan-int101 |
24.24.24.4/24 |
|
Vlan-int200 |
13.13.13.1/24 |
|
Vlan-int200 |
13.13.13.2/24 |
|
Loop0 |
1.1.1.1/32 |
|
Loop0 |
4.4.4.4/32 |
Switch C |
Vlan-int100 |
12.12.12.2/24 |
|
|
|
|
Vlan-int101 |
24.24.24.2/24 |
|
|
|
(1) 配置各接口的IP地址(略)
(2) 配置鏈路A上的靜態路由快速重路由
靜態路由支持快速重路由配置有兩種方法,可以任選一種
方法一:配置靜態路由快速重路由功能(手工指定備份下一跳)
# 在Switch A上配置靜態路由,並指定備份出接口和下一跳。
<SwitchA> system-view
[SwitchA] ip route-static 4.4.4.4 32 vlan-interface 200 13.13.13.2 backup-interface vlan-interface 100 backup-nexthop 12.12.12.2
# 在Switch B上配置靜態路由,並指定備份出接口和下一跳。
<SwitchB> system-view
[SwitchB] ip route-static 1.1.1.1 32 vlan-interface 200 13.13.13.1 backup-interface vlan-interface 101 backup-nexthop 24.24.24.2
方法二:配置靜態路由快速重路由功能(自動查找備份下一跳)
# 在Switch A上配置靜態路由,並配置靜態路由自動快速重路由功能。
<SwitchA> system-view
[SwitchA] ip route-static 4.4.4.4 32 vlan-interface 200 13.13.13.2
[SwitchA] ip route-static 4.4.4.4 32 vlan-interface 100 12.12.12.2 preference 70
[SwitchA] ip route-static fast-reroute auto
# 在Switch B上配置靜態路由,並配置靜態路由自動快速重路由功能。
<SwitchB> system-view
[SwitchB] ip route-static 1.1.1.1 32 vlan-interface 200 13.13.13.1
[SwitchB] ip route-static 1.1.1.1 32 vlan-interface 101 24.24.24.2 preference 70
[SwitchB] ip route-static fast-reroute auto
(3) 配置鏈路B上的靜態路由
# 在Switch C上配置靜態路由。
<SwitchC> system-view
[SwitchC] ip route-static 4.4.4.4 32 vlan-interface 101 24.24.24.4
[SwitchC] ip route-static 1.1.1.1 32 vlan-interface 100 12.12.12.1
# 在Switch A上查看4.4.4.4/32路由,可以看到備份下一跳信息。
[SwitchA] display ip routing-table 4.4.4.4 verbose
Summary count : 1
Destination: 4.4.4.4/32
Protocol: Static
Process ID: 0
SubProtID: 0x0 Age: 04h20m37s
Cost: 0 Preference: 60
IpPre: N/A QosLocalID: N/A
Tag: 0 State: Active Adv
OrigTblID: 0x0 OrigVrf: default-vrf
TableID: 0x2 OrigAs: 0
NibID: 0x26000002 LastAs: 0
AttrID: 0xffffffff Neighbor: 0.0.0.0
Flags: 0x1008c OrigNextHop: 13.13.13.2
Label: NULL RealNextHop: 13.13.13.2
BkLabel: NULL BkNextHop: 12.12.12.2
SRLabel: NULL BkSRLabel: NULL
SIDIndex: NULL InLabel: NULL
Tunnel ID: Invalid Interface: Vlan-interface200
BkTunnel ID: Invalid BkInterface: Vlan-interface100
FtnIndex: 0x0 TrafficIndex: N/A
Connector: N/A PathID: 0x0
LinkCost: 0 MicroSegID: 0
RealFIRType: Normal RealThres: 0
# 在Switch B上查看1.1.1.1/32路由,可以看到備份下一跳信息。
[SwitchB] display ip routing-table 1.1.1.1 verbose
Summary count : 1
Destination: 1.1.1.1/32
Protocol: Static
Process ID: 0
SubProtID: 0x0 Age: 04h20m37s
Cost: 0 Preference: 60
IpPre: N/A QosLocalID: N/A
Tag: 0 State: Active Adv
OrigTblID: 0x0 OrigVrf: default-vrf
TableID: 0x2 OrigAs: 0
NibID: 0x26000002 LastAs: 0
AttrID: 0xffffffff Neighbor: 0.0.0.0
Flags: 0x1008c OrigNextHop: 13.13.13.1
Label: NULL RealNextHop: 13.13.13.1
BkLabel: NULL BkNextHop: 24.24.24.2
SRLabel: NULL BkSRLabel: NULL
SIDIndex: NULL InLabel: NULL
Tunnel ID: Invalid Interface: Vlan-interface200
BkTunnel ID: Invalid BkInterface: Vlan-interface101
FtnIndex: 0x0 TrafficIndex: N/A
Connector: N/A PathID: 0x0
LinkCost: 0 MicroSegID: 0
RealFIRType: Normal RealThres: 0
缺省路由是在路由器沒有找到匹配的路由表項時使用的路由。
如果報文的目的地不在路由表中且沒有配置缺省路由,那麼該報文將被丟棄,將向源端返回一個ICMP報文報告該目的地址或網絡不可達。
· 第一種是網絡管理員手工配置。配置請參見“1.2 配置靜態路由”,將目的地址與掩碼配置為全零(0.0.0.0 0.0.0.0)。
· 第二種是動態路由協議生成(如OSPF、IS-IS和RIP),由路由能力比較強的路由器將缺省路由發布給其它路由器,其它路由器在自己的路由表裏生成指向那台路由器的缺省路由。配置請參見各個路由協議手冊。
如圖2-1所示,Device A發往Device C、Device D和Device E的報文下一跳都是Device B,因此可在Device A上配置一條缺省路由,代替配置通往Device C、Device D和Device E網絡的3條靜態路由。配置完成後,如果報文沒有其他滿足匹配的路由表項,則會通過缺省路由轉發出去。
在Device A上配置缺省路由時,需要將目的地址和掩碼配置為全零(0.0.0.0 0.0.0.0),下一跳地址為Device B接口的地址1.1.1.2。
不同款型規格的資料略有差異, 詳細信息請向具體銷售和400谘詢。H3C保留在沒有任何通知或提示的情況下對資料內容進行修改的權利!