mpls router ldp
ldp router-id interface Loopback 0 force
advertise-labels for host-routes
請問advertise-labels for host-routes這個命令翻譯為h3c是哪個
(0)
您好,請知:
以下是配置案例,請參考:
· Switch A、Switch B和Switch C均支持MPLS。
· 在Switch A和Switch C之間使用LDP動態建立LSP,使11.1.1.0/24和21.1.1.0/24這兩個網段中互訪的報文能夠通過MPLS進行傳輸。
· Switch A、Switch B和Switch C上隻允許目的地址為1.1.1.9/32、2.2.2.9/32、3.3.3.9/32、11.1.1.0/24和21.1.1.0/24的路由表項觸發LDP建立LSP,其他路由表項不能觸發LDP建立LSP,以避免建立的LSP數量過多,影響設備性能。
圖1-11 利用LDP動態建立LSP配置組網圖
· LDP根據路由信息動態分配標簽,因此,利用LDP動態建立LSP時,需要配置路由協議,使得各交換機之間路由可達。本例中,采用的路由協議為OSPF。
· 在各台路由器上啟動LDP協議。
· 為了控製建立的LSP數量,在Switch A、Switch B和Switch C上需要配置LSP觸發策略。
(1) 配置各接口的IP地址
按照圖1-11配置各接口IP地址和掩碼,包括VLAN接口和Loopback接口,具體配置過程略。
(2) 配置OSPF,以保證各交換機之間路由可達
# 配置Switch A。
<SwitchA> system-view
[SwitchA] ospf
[SwitchA-ospf-1] area 0
[SwitchA-ospf-1-area-0.0.0.0] network 1.1.1.9 0.0.0.0
[SwitchA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] network 11.1.1.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] quit
[SwitchA-ospf-1] quit
# 配置Switch B。
<SwitchB> system-view
[SwitchB] ospf
[SwitchB-ospf-1] area 0
[SwitchB-ospf-1-area-0.0.0.0] network 2.2.2.9 0.0.0.0
[SwitchB-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] network 20.1.1.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] quit
[SwitchB-ospf-1] quit
# 配置Switch C。
<SwitchC> system-view
[SwitchC] ospf
[SwitchC-ospf-1] area 0
[SwitchC-ospf-1-area-0.0.0.0] network 3.3.3.9 0.0.0.0
[SwitchC-ospf-1-area-0.0.0.0] network 20.1.1.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.0] network 21.1.1.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.0] quit
[SwitchC-ospf-1] quit
# 配置完成後,在各交換機上執行display ip routing-table命令,可以看到相互之間都學到了到對方的主機路由。以Switch A為例:
[SwitchA] display ip routing-table
Destinations : 21 Routes : 21
Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
1.1.1.9/32 Direct 0 0 127.0.0.1 InLoop0
2.2.2.9/32 O_INTRA 10 1 10.1.1.2 Vlan2
3.3.3.9/32 O_INTRA 10 2 10.1.1.2 Vlan2
10.1.1.0/24 Direct 0 0 10.1.1.1 Vlan2
10.1.1.0/32 Direct 0 0 10.1.1.1 Vlan2
10.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
10.1.1.255/32 Direct 0 0 10.1.1.1 Vlan2
11.1.1.0/24 Direct 0 0 11.1.1.1 Vlan4
11.1.1.0/32 Direct 0 0 11.1.1.1 Vlan4
11.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
11.1.1.255/32 Direct 0 0 11.1.1.1 Vlan4
20.1.1.0/24 O_INTRA 10 2 10.1.1.2 Vlan2
21.1.1.0/24 O_INTRA 10 3 10.1.1.2 Vlan2
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
224.0.0.0/4 Direct 0 0 0.0.0.0 NULL0
224.0.0.0/24 Direct 0 0 0.0.0.0 NULL0
255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
(3) 使能MPLS和LDP功能
# 配置Switch A。
[SwitchA] mpls lsr-id 1.1.1.9
[SwitchA] mpls ldp
[SwitchA-ldp] quit
[SwitchA] interface vlan-interface 2
[SwitchA-Vlan-interface2] mpls enable
[SwitchA-Vlan-interface2] mpls ldp enable
[SwitchA-Vlan-interface2] quit
# 配置Switch B。
[SwitchB] mpls lsr-id 2.2.2.9
[SwitchB] mpls ldp
[SwitchB-ldp] quit
[SwitchB] interface vlan-interface 2
[SwitchB-Vlan-interface2] mpls enable
[SwitchB-Vlan-interface2] mpls ldp enable
[SwitchB-Vlan-interface2] quit
[SwitchB] interface vlan-interface 3
[SwitchB-Vlan-interface3] mpls enable
[SwitchB-Vlan-interface3] mpls ldp enable
[SwitchB-Vlan-interface3] quit
# 配置Switch C。
[SwitchC] mpls lsr-id 3.3.3.9
[SwitchC] mpls ldp
[SwitchC-ldp] quit
[SwitchC] interface vlan-interface 3
[SwitchC-Vlan-interface3] mpls enable
[SwitchC-Vlan-interface3] mpls ldp enable
[SwitchC-Vlan-interface3] quit
(4) 配置LSP觸發策略
# 在Switch A上創建IP地址前綴列表switcha,並配置隻有通過該列表過濾的路由表項能夠觸發LDP建立LSP。
[SwitchA] ip prefix-list switcha index 10 permit 1.1.1.9 32
[SwitchA] ip prefix-list switcha index 20 permit 2.2.2.9 32
[SwitchA] ip prefix-list switcha index 30 permit 3.3.3.9 32
[SwitchA] ip prefix-list switcha index 40 permit 11.1.1.0 24
[SwitchA] ip prefix-list switcha index 50 permit 21.1.1.0 24
[SwitchA] mpls ldp
[SwitchA-ldp] lsp-trigger prefix-list switcha
[SwitchA-ldp] quit
# 在Switch B上創建IP地址前綴列表switchb,並配置隻有通過該列表過濾的路由表項能夠觸發LDP建立LSP。
[SwitchB] ip prefix-list switchb index 10 permit 1.1.1.9 32
[SwitchB] ip prefix-list switchb index 20 permit 2.2.2.9 32
[SwitchB] ip prefix-list switchb index 30 permit 3.3.3.9 32
[SwitchB] ip prefix-list switchb index 40 permit 11.1.1.0 24
[SwitchB] ip prefix-list switchb index 50 permit 21.1.1.0 24
[SwitchB] mpls ldp
[SwitchB-ldp] lsp-trigger prefix-list switchb
[SwitchB-ldp] quit
# 在Switch C上創建IP地址前綴列表switchc,並配置隻有通過該列表過濾的路由表項能夠觸發LDP建立LSP。
[SwitchC] ip prefix-list switchc index 10 permit 1.1.1.9 32
[SwitchC] ip prefix-list switchc index 20 permit 2.2.2.9 32
[SwitchC] ip prefix-list switchc index 30 permit 3.3.3.9 32
[SwitchC] ip prefix-list switchc index 40 permit 11.1.1.0 24
[SwitchC] ip prefix-list switchc index 50 permit 21.1.1.0 24
[SwitchC] mpls ldp
[SwitchC-ldp] lsp-trigger prefix-list switchc
[SwitchC-ldp] quit
# 配置完成後,在各交換機上執行display mpls ldp lsp命令,可以看到LDP LSP的建立情況。以Switch A為例:
[SwitchA] display mpls ldp lsp
Status Flags: * - stale, L - liberal, B - backup, N/A – unavailable
FECs: 5 Ingress: 3 Transit: 3 Egress: 2
FEC In/Out Label Nexthop OutInterface/LSINDEX
1.1.1.9/32 3/-
-/1279(L)
2.2.2.9/32 -/3 10.1.1.2 Vlan2
1279/3 10.1.1.2 Vlan2
3.3.3.9/32 -/1278 10.1.1.2 Vlan2
1278/1278 10.1.1.2 Vlan2
11.1.1.0/24 1277/-
-/1277(L)
21.1.1.0/24 -/1276 10.1.1.2 Vlan2
1276/1276 10.1.1.2 Vlan2
# 在Switch A上檢測Switch A到Switch C的LDP LSP的可達性。
[SwitchA] ping mpls -a 11.1.1.1 ipv4 21.1.1.0 24
MPLS ping FEC: 21.1.1.0/24 with 100 bytes of data:
100 bytes from 20.1.1.2: Sequence=1 time=1 ms
100 bytes from 20.1.1.2: Sequence=2 time=1 ms
100 bytes from 20.1.1.2: Sequence=3 time=8 ms
100 bytes from 20.1.1.2: Sequence=4 time=2 ms
100 bytes from 20.1.1.2: Sequence=5 time=1 ms
--- Ping statistics for FEC 21.1.1.0/24 ---
5 packets transmitted, 5 packets received, 0.0% packet loss
Round-trip min/avg/max = 1/2/8 ms
# 在Switch C上檢測Switch C到Switch A的LDP LSP的可達性。
[SwitchC] ping mpls -a 21.1.1.1 ipv4 11.1.1.0 24
MPLS ping FEC: 11.1.1.0/24 with 100 bytes of data:
100 bytes from 10.1.1.1: Sequence=1 time=1 ms
100 bytes from 10.1.1.1: Sequence=2 time=1 ms
100 bytes from 10.1.1.1: Sequence=3 time=1 ms
100 bytes from 10.1.1.1: Sequence=4 time=1 ms
100 bytes from 10.1.1.1: Sequence=5 time=1 ms
--- Ping statistics for FEC 11.1.1.0/24 ---
5 packets transmitted, 5 packets received, 0.0% packet loss
Round-trip min/avg/max = 1/1/1 ms
11.1.1.0/24和21.1.1.0/24網段之間存在兩條路徑:Switch A—Switch B—Switch C和Switch A—Switch D—Switch C。通過配置標簽接受控製策略,實現隻沿著路徑Switch A—Switch B—Switch C建立LSP,11.1.1.0/24和21.1.1.0/24網段之間互訪的報文通過該LSP進行MPLS轉發。
(1) 在各台交換機上配置路由協議,使得各交換機之間路由可達。本例中,采用的路由協議為OSPF。
(2) 在各台交換機上啟動LDP協議。
(3) 在各台交換機上配置LSP觸發策略,使得目的地址為11.1.1.0/24和21.1.1.0/24的路由表項能夠觸發LDP建立LSP。
(4) 配置標簽接受控製策略,使得LDP僅沿著路徑Switch A—Switch B—Switch C建立LSP。具體配置方法為:
· Switch A隻接受Switch B通告的FEC目的地址為21.1.1.0/24的FEC—標簽映射;Switch A拒絕Switch D通告的FEC目的地址為21.1.1.0/24的FEC—標簽映射。
· Switch C隻接受Switch B通告的FEC目的地址為11.1.1.0/24的FEC—標簽映射;Switch C拒絕Switch D通告的FEC目的地址為11.1.1.0/24的FEC—標簽映射。
進行下麵配置之前,需要先全局關閉STP功能,或為每個VLAN映射一個MSTP實例,具體配置方法請參見“二層技術-以太網交換配置指導”中的“生成樹”。
(1) 配置各接口的IP地址
按照圖1-12配置各接口IP地址和掩碼,包括Loopback接口,具體配置過程略。
(2) 配置OSPF
在各台交換機上配置OSPF,以保證各交換機之間路由可達,具體配置過程略。
(3) 使能MPLS和LDP功能
# 配置Switch A。
<SwitchA> system-view
[SwitchA] mpls lsr-id 1.1.1.9
[SwitchA] mpls ldp
[SwitchA-ldp] quit
[SwitchA] interface vlan-interface 2
[SwitchA-Vlan-interface2] mpls enable
[SwitchA-Vlan-interface2] mpls ldp enable
[SwitchA-Vlan-interface2] quit
[SwitchA] interface vlan-interface 6
[SwitchA-Vlan-interface6] mpls enable
[SwitchA-Vlan-interface6] mpls ldp enable
[SwitchA-Vlan-interface6] quit
# 配置Switch B。
<SwitchB> system-view
[SwitchB] mpls lsr-id 2.2.2.9
[SwitchB] mpls ldp
[SwitchB-ldp] quit
[SwitchB] interface vlan-interface 2
[SwitchB-Vlan-interface2] mpls enable
[SwitchB-Vlan-interface2] mpls ldp enable
[SwitchB-Vlan-interface2] quit
[SwitchB] interface vlan-interface 3
[SwitchB-Vlan-interface3] mpls enable
[SwitchB-Vlan-interface3] mpls ldp enable
[SwitchB-Vlan-interface3] quit
# 配置Switch C。
<SwitchC> system-view
[SwitchC] mpls lsr-id 3.3.3.9
[SwitchC] mpls ldp
[SwitchC-ldp] quit
[SwitchC] interface vlan-interface 3
[SwitchC-Vlan-interface3] mpls enable
[SwitchC-Vlan-interface3] mpls ldp enable
[SwitchC-Vlan-interface3] quit
[SwitchC] interface vlan-interface 7
[SwitchC-Vlan-interface7] mpls enable
[SwitchC-Vlan-interface7] mpls ldp enable
[SwitchC-Vlan-interface7] quit
# 配置Switch D。
<SwitchD> system-view
[SwitchD] mpls lsr-id 4.4.4.9
[SwitchD] mpls ldp
[SwitchD-ldp] quit
[SwitchD] interface vlan-interface 6
[SwitchD-Vlan-interface6] mpls enable
[SwitchD-Vlan-interface6] mpls ldp enable
[SwitchD-Vlan-interface6] quit
[SwitchD] interface vlan-interface 7
[SwitchD-Vlan-interface7] mpls enable
[SwitchD-Vlan-interface7] mpls ldp enable
[SwitchD-Vlan-interface7] quit
(4) 配置LSP觸發策略
# 在Switch A上創建IP地址前綴列表switcha,並配置隻有通過該列表過濾的路由表項能夠觸發LDP建立LSP。
[SwitchA] ip prefix-list switcha index 10 permit 11.1.1.0 24
[SwitchA] ip prefix-list switcha index 20 permit 21.1.1.0 24
[SwitchA] mpls ldp
[SwitchA-ldp] lsp-trigger prefix-list switcha
[SwitchA-ldp] quit
# 在Switch B上創建IP地址前綴列表switchb,並配置隻有通過該列表過濾的路由表項能夠觸發LDP建立LSP。
[SwitchB] ip prefix-list switchb index 10 permit 11.1.1.0 24
[SwitchB] ip prefix-list switchb index 20 permit 21.1.1.0 24
[SwitchB] mpls ldp
[SwitchB-ldp] lsp-trigger prefix-list switchb
[SwitchB-ldp] quit
# 在Switch C上創建IP地址前綴列表switchc,並配置隻有通過該列表過濾的路由表項能夠觸發LDP建立LSP。
[SwitchC] ip prefix-list switchc index 10 permit 11.1.1.0 24
[SwitchC] ip prefix-list switchc index 20 permit 21.1.1.0 24
[SwitchC] mpls ldp
[SwitchC-ldp] lsp-trigger prefix-list switchc
[SwitchC-ldp] quit
# 在Switch D上創建IP地址前綴列表switchd,並配置隻有通過該列表過濾的路由表項能夠觸發LDP建立LSP。
[SwitchD] ip prefix-list switchd index 10 permit 11.1.1.0 24
[SwitchD] ip prefix-list switchd index 20 permit 21.1.1.0 24
[SwitchD] mpls ldp
[SwitchD-ldp] lsp-trigger prefix-list switchd
[SwitchD-ldp] quit
(5) 配置標簽接受控製策略
# 在Switch A上創建允許21.1.1.0/24通過的IP地址前綴列表prefix-from-b,該列表用來過濾Switch B通告給Switch A的FEC—標簽映射。
[SwitchA] ip prefix-list prefix-from-b index 10 permit 21.1.1.0 24
# 在Switch A上創建拒絕21.1.1.0/24通過的IP地址前綴列表prefix-from-d,該列表用來過濾Switch D通告給Switch A的FEC—標簽映射。
[SwitchA] ip prefix-list prefix-from-d index 10 deny 21.1.1.0 24
# 在Switch A上配置過濾Switch B和Switch D通告的FEC—標簽映射的標簽接受控製策略。
[SwitchA] mpls ldp
[SwitchA-ldp] accept-label peer 2.2.2.9 prefix-list prefix-from-b
[SwitchA-ldp] accept-label peer 4.4.4.9 prefix-list prefix-from-d
[SwitchA-ldp] quit
# 在Switch C上創建允許11.1.1.0/24通過的IP地址前綴列表prefix-from-b,該列表用來過濾Switch B通告給Switch C的FEC—標簽映射。
[SwitchC] ip prefix-list prefix-from-b index 10 permit 11.1.1.0 24
# 在Switch C上創建拒絕11.1.1.0/24通過的IP地址前綴列表prefix-from-d,該列表用來過濾Switch D通告給Switch C的FEC—標簽映射。
[SwitchC] ip prefix-list prefix-from-d index 10 deny 11.1.1.0 24
# 在Switch C上配置過濾Switch B和Switch D通告的FEC—標簽映射的標簽接受控製策略。
[SwitchC] mpls ldp
[SwitchC-ldp] accept-label peer 2.2.2.9 prefix-list prefix-from-b
[SwitchC-ldp] accept-label peer 4.4.4.9 prefix-list prefix-from-d
[SwitchC-ldp] quit
# 配置完成後,在各設備上執行display mpls ldp lsp命令,可以看到LDP LSP的建立情況。以Switch A為例,在Switch A上FEC目的地址為21.1.1.0/24的LSP的下一跳為Switch B(地址為10.1.1.2),即隻沿著路徑Switch A—Switch B—Switch C建立了LSP,路徑Switch A—Switch D—Switch C上未建立LSP。
[SwitchA] display mpls ldp lsp
Status Flags: * - stale, L - liberal, B - backup, N/A – unavailable
FECs: 2 Ingress: 1 Transit: 1 Egress: 1
FEC In/Out Label Nexthop OutInterface/LSINDEX
11.1.1.0/24 1277/-
-/1148(L)
21.1.1.0/24 -/1149(L)
-/1276 10.1.1.2 Vlan2
1276/1276 10.1.1.2 Vlan2
# 在Switch A上檢測Switch A到Switch C的LDP LSP的可達性。
[SwitchA] ping mpls -a 11.1.1.1 ipv4 21.1.1.0 24
MPLS ping FEC: 21.1.1.0/24 with 100 bytes of data:
100 bytes from 20.1.1.2: Sequence=1 time=1 ms
100 bytes from 20.1.1.2: Sequence=2 time=1 ms
100 bytes from 20.1.1.2: Sequence=3 time=8 ms
100 bytes from 20.1.1.2: Sequence=4 time=2 ms
100 bytes from 20.1.1.2: Sequence=5 time=1 ms
--- Ping statistics for FEC 21.1.1.0/24 ---
5 packets transmitted, 5 packets received, 0.0% packet loss
Round-trip min/avg/max = 1/2/8 ms
# 在Switch C上檢測Switch C到Switch A的LDP LSP的可達性。
[SwitchC] ping mpls -a 21.1.1.1 ipv4 11.1.1.0 24
MPLS ping FEC: 11.1.1.0/24 with 100 bytes of data:
100 bytes from 10.1.1.1: Sequence=1 time=1 ms
100 bytes from 10.1.1.1: Sequence=2 time=1 ms
100 bytes from 10.1.1.1: Sequence=3 time=1 ms
100 bytes from 10.1.1.1: Sequence=4 time=1 ms
100 bytes from 10.1.1.1: Sequence=5 time=1 ms
--- Ping statistics for FEC 11.1.1.0/24 ---
5 packets transmitted, 5 packets received, 0.0% packet loss
Round-trip min/avg/max = 1/1/1 ms
11.1.1.0/24和21.1.1.0/24網段之間存在兩條路徑:Switch A—Switch B—Switch C和Switch A—Switch D—Switch C。通過配置標簽通告控製策略,實現隻沿著路徑Switch A—Switch B—Switch C建立LSP,11.1.1.0/24和21.1.1.0/24網段之間互訪的報文通過該LSP進行MPLS轉發。
(1) 在各台交換機上配置路由協議,使得各交換機之間路由可達。本例中,采用的路由協議為OSPF。
(2) 在各台交換機上啟動LDP協議。
(3) 在各台交換機上配置LSP觸發策略,使得目的地址為11.1.1.0/24和21.1.1.0/24的路由表項能夠觸發LDP建立LSP。
(4) 配置標簽通告控製策略,使得LDP僅沿著路徑Switch A—Switch B—Switch C建立LSP。具體配置方法為:
· Switch A隻將FEC目的地址為11.1.1.0/24的FEC—標簽映射通告給Switch B;Switch A不通告任何其他的FEC—標簽映射。
· Switch C隻將FEC目的地址為21.1.1.0/24的FEC—標簽映射通告給Switch B;Switch C不通告任何其他的FEC—標簽映射。
· Switch D不將FEC目的地址為21.1.1.0/24的FEC—標簽映射通告給Switch A;Switch D不將FEC目的地址為11.1.1.0/24的FEC—標簽映射通告給Switch C。
進行下麵配置之前,需要先全局關閉STP功能,或為每個VLAN映射一個MSTP實例,具體配置方法請參見“二層技術-以太網交換配置指導”中的“生成樹”。
(1) 配置各接口的IP地址
按照圖1-13配置各接口IP地址和掩碼,包括Loopback接口,具體配置過程略。
(2) 配置OSPF
在各台交換機上配置OSPF,以保證各交換機之間路由可達,具體配置過程略。
(3) 使能MPLS和LDP功能
# 配置Switch A。
<SwitchA> system-view
[SwitchA] mpls lsr-id 1.1.1.9
[SwitchA] mpls ldp
[SwitchA-ldp] quit
[SwitchA] interface vlan-interface 2
[SwitchA-Vlan-interface2] mpls enable
[SwitchA-Vlan-interface2] mpls ldp enable
[SwitchA-Vlan-interface2] quit
[SwitchA] interface vlan-interface 6
[SwitchA-Vlan-interface6] mpls enable
[SwitchA-Vlan-interface6] mpls ldp enable
[SwitchA-Vlan-interface6] quit
# 配置Switch B。
<SwitchB> system-view
[SwitchB] mpls lsr-id 2.2.2.9
[SwitchB] mpls ldp
[SwitchB-ldp] quit
[SwitchB] interface vlan-interface 2
[SwitchB-Vlan-interface2] mpls enable
[SwitchB-Vlan-interface2] mpls ldp enable
[SwitchB-Vlan-interface2] quit
[SwitchB] interface vlan-interface 3
[SwitchB-Vlan-interface3] mpls enable
[SwitchB-Vlan-interface3] mpls ldp enable
[SwitchB-Vlan-interface3] quit
# 配置Switch C。
<SwitchC> system-view
[SwitchC] mpls lsr-id 3.3.3.9
[SwitchC] mpls ldp
[SwitchC-ldp] quit
[SwitchC] interface vlan-interface 3
[SwitchC-Vlan-interface3] mpls enable
[SwitchC-Vlan-interface3] mpls ldp enable
[SwitchC-Vlan-interface3] quit
[SwitchC] interface vlan-interface 7
[SwitchC-Vlan-interface7] mpls enable
[SwitchC-Vlan-interface7] mpls ldp enable
[SwitchC-Vlan-interface7] quit
# 配置Switch D。
<SwitchD> system-view
[SwitchD] mpls lsr-id 4.4.4.9
[SwitchD] mpls ldp
[SwitchD-ldp] quit
[SwitchD] interface vlan-interface 6
[SwitchD-Vlan-interface6] mpls enable
[SwitchD-Vlan-interface6] mpls ldp enable
[SwitchD-Vlan-interface6] quit
[SwitchD] interface vlan-interface 7
[SwitchD-Vlan-interface7] mpls enable
[SwitchD-Vlan-interface7] mpls ldp enable
[SwitchD-Vlan-interface7] quit
(4) 配置LSP觸發策略
# 在Switch A上創建IP地址前綴列表switcha,並配置隻有通過該列表過濾的路由表項能夠觸發LDP建立LSP。
[SwitchA] ip prefix-list switcha index 10 permit 11.1.1.0 24
[SwitchA] ip prefix-list switcha index 20 permit 21.1.1.0 24
[SwitchA] mpls ldp
[SwitchA-ldp] lsp-trigger prefix-list switcha
[SwitchA-ldp] quit
# 在Switch B上創建IP地址前綴列表switchb,並配置隻有通過該列表過濾的路由表項能夠觸發LDP建立LSP。
[SwitchB] ip prefix-list switchb index 10 permit 11.1.1.0 24
[SwitchB] ip prefix-list switchb index 20 permit 21.1.1.0 24
[SwitchB] mpls ldp
[SwitchB-ldp] lsp-trigger prefix-list switchb
[SwitchB-ldp] quit
# 在Switch C上創建IP地址前綴列表switchc,並配置隻有通過該列表過濾的路由表項能夠觸發LDP建立LSP。
[SwitchC] ip prefix-list switchc index 10 permit 11.1.1.0 24
[SwitchC] ip prefix-list switchc index 20 permit 21.1.1.0 24
[SwitchC] mpls ldp
[SwitchC-ldp] lsp-trigger prefix-list switchc
[SwitchC-ldp] quit
# 在Switch D上創建IP地址前綴列表switchd,並配置隻有通過該列表過濾的路由表項能夠觸發LDP建立LSP。
[SwitchD] ip prefix-list switchd index 10 permit 11.1.1.0 24
[SwitchD] ip prefix-list switchd index 20 permit 21.1.1.0 24
[SwitchD] mpls ldp
[SwitchD-ldp] lsp-trigger prefix-list switchd
[SwitchD-ldp] quit
(5) 配置標簽通告控製策略
# 在Switch A上創建允許11.1.1.0/24通過的IP地址前綴列表prefix-to-b,該列表用來過濾通告給Switch B的FEC—標簽映射。
[SwitchA] ip prefix-list prefix-to-b index 10 permit 11.1.1.0 24
# 在Switch A上創建允許2.2.2.9/32通過的IP地址前綴列表peer-b,該列表用來過濾LDP對等體。
[SwitchA] ip prefix-list peer-b index 10 permit 2.2.2.9 32
# 在Switch A上配置標簽通告控製策略:隻將FEC目的地址為11.1.1.0/24的FEC—標簽映射通告給Switch B。
[SwitchA] mpls ldp
[SwitchA-ldp] advertise-label prefix-list prefix-to-b peer peer-b
[SwitchA-ldp] quit
# 在Switch C上創建允許21.1.1.0/24通過的IP地址前綴列表prefix-to-b,該列表用來過濾通告給Switch B的FEC—標簽映射。
[SwitchC] ip prefix-list prefix-to-b index 10 permit 21.1.1.0 24
# 在Switch C上創建允許2.2.2.9/32通過的IP地址前綴列表peer-b,該列表用來過濾LDP對等體。
[SwitchC] ip prefix-list peer-b index 10 permit 2.2.2.9 32
# 在Switch C上配置標簽通告控製策略:隻將FEC目的地址為21.1.1.0/24的FEC—標簽映射通告給Switch B。
[SwitchC] mpls ldp
[SwitchC-ldp] advertise-label prefix-list prefix-to-b peer peer-b
[SwitchC-ldp] quit
# 在Switch D上創建拒絕21.1.1.0/24通過的IP地址前綴列表prefix-to-a,該列表用來過濾通告給Switch A的FEC—標簽映射。
[SwitchD] ip prefix-list prefix-to-a index 10 deny 21.1.1.0 24
[SwitchD] ip prefix-list prefix-to-a index 20 permit 0.0.0.0 0 less-equal 32
# 在Switch D上創建允許1.1.1.9/32通過的IP地址前綴列表peer-a,該列表用來過濾LDP對等體。
[SwitchD] ip prefix-list peer-a index 10 permit 1.1.1.9 32
# 在Switch D上創建拒絕11.1.1.0/24通過的IP地址前綴列表prefix-to-c,該列表用來過濾通告給Switch C的FEC—標簽映射。
[SwitchD] ip prefix-list prefix-to-c index 10 deny 11.1.1.0 24
[SwitchD] ip prefix-list prefix-to-c index 20 permit 0.0.0.0 0 less-equal 32
# 在Switch D上創建允許3.3.3.9/32通過的IP地址前綴列表peer-c,該列表用來過濾LDP對等體。
[SwitchD] ip prefix-list peer-c index 10 permit 3.3.3.9 32
# 在Switch D上配置標簽通告控製策略:不將FEC目的地址為21.1.1.0/24的FEC—標簽映射通告給Switch A;不將FEC目的地址為11.1.1.0/24的FEC—標簽映射通告給Switch C。
[SwitchD] mpls ldp
[SwitchD-ldp] advertise-label prefix-list prefix-to-a peer peer-a
[SwitchD-ldp] advertise-label prefix-list prefix-to-c peer peer-c
[SwitchD-ldp] quit
# 配置完成後,在各設備上執行display mpls ldp lsp命令,可以看到LDP LSP的建立情況。Switch A和Switch C隻接收到Switch B通告的FEC—標簽映射;Switch B接收到了Switch A和Switch C通告的FEC—標簽映射; Switch D沒有接收到Switch A和Switch C通告的FEC—標簽映射;即隻沿著路徑Switch A—Switch B—Switch C建立了LSP。
[SwitchA] display mpls ldp lsp
Status Flags: * - stale, L - liberal, B - backup, N/A – unavailable
FECs: 2 Ingress: 1 Transit: 1 Egress: 1
FEC In/Out Label Nexthop OutInterface/LSINDEX
11.1.1.0/24 1277/-
-/1151(L)
-/1277(L)
21.1.1.0/24 -/1276 10.1.1.2 Vlan2
1276/1276 10.1.1.2 Vlan2
[SwitchB] display mpls ldp lsp
Status Flags: * - stale, L - liberal, B - backup, N/A – unavailable
FECs: 2 Ingress: 2 Transit: 2 Egress: 0
FEC In/Out Label Nexthop OutInterface/LSINDEX
11.1.1.0/24 -/1277 10.1.1.1 Vlan2
1277/1277 10.1.1.1 Vlan2
21.1.1.0/24 -/1149 20.1.1.2 Vlan3
1276/1149 20.1.1.2 Vlan3
[SwitchC] display mpls ldp lsp
Status Flags: * - stale, L - liberal, B - backup, N/A – unavailable
FECs: 2 Ingress: 1 Transit: 1 Egress: 1
FEC In/Out Label Nexthop OutInterface/LSINDEX
11.1.1.0/24 -/1277 20.1.1.1 Vlan3
1148/1277 20.1.1.1 Vlan3
21.1.1.0/24 1149/-
-/1276(L)
-/1150(L)
[SwitchD] display mpls ldp lsp
Status Flags: * - stale, L - liberal, B - backup, N/A – unavailable
FECs: 2 Ingress: 0 Transit: 0 Egress: 2
FEC In/Out Label Nexthop OutInterface/LSINDEX
11.1.1.0/24 1151/-
-/1277(L)
21.1.1.0/24 1150/-
# 在Switch A上檢測Switch A到Switch C的LDP LSP的可達性。
[SwitchA] ping mpls -a 11.1.1.1 ipv4 21.1.1.0 24
MPLS ping FEC: 21.1.1.0/24 with 100 bytes of data:
100 bytes from 20.1.1.2: Sequence=1 time=1 ms
100 bytes from 20.1.1.2: Sequence=2 time=1 ms
100 bytes from 20.1.1.2: Sequence=3 time=8 ms
100 bytes from 20.1.1.2: Sequence=4 time=2 ms
100 bytes from 20.1.1.2: Sequence=5 time=1 ms
--- Ping statistics for FEC 21.1.1.0/24 ---
5 packets transmitted, 5 packets received, 0.0% packet loss
Round-trip min/avg/max = 1/2/8 ms
# 在Switch C上檢測Switch C到Switch A的LDP LSP的可達性。
[SwitchC] ping mpls -a 21.1.1.1 ipv4 11.1.1.0 24
MPLS ping FEC: 11.1.1.0/24 with 100 bytes of data:
100 bytes from 10.1.1.1: Sequence=1 time=1 ms
100 bytes from 10.1.1.1: Sequence=2 time=1 ms
100 bytes from 10.1.1.1: Sequence=3 time=1 ms
100 bytes from 10.1.1.1: Sequence=4 time=1 ms
100 bytes from 10.1.1.1: Sequence=5 time=1 ms
--- Ping statistics for FEC 11.1.1.0/24 ---
5 packets transmitted, 5 packets received, 0.0% packet loss
Round-trip min/avg/max = 1/1/1 ms
Switch S、Switch A和Switch D屬於同一OSPF區域,通過OSPF協議實現網絡互連。在Switch S—Switch D、Switch S—Switch A—Switch D兩條路徑上利用LDP分別建立主LSP和備份LSP,實現:
· 當Switch S—Switch D這條LSP正常工作時,11.1.1.0/24和21.1.1.0/24兩個網段之間的流量通過該LSP傳輸。
· 當Switch S—Switch D這條LSP出現故障時,11.1.1.0/24和21.1.1.0/24兩個網段之間的流量快速切換到Switch S—Switch A—Switch D這條備份LSP上傳輸。
圖1-14 LDP快速重路由配置組網圖
· 在各台交換機上配置路由協議,使得各交換機之間路由可達。本例中,采用的路由協議為OSPF。
· 在各台交換機上啟動LDP協議。
· 在各台交換機上配置LSP觸發策略,使得目的地址為11.1.1.0/24和21.1.1.0/24的路由表項能夠觸發LDP建立LSP。
· 為了觸發建立備份LSP,在Switch S和Switch D上需要配置OSPF快速重路由。
進行下麵配置之前,需要先全局關閉STP功能,或為每個VLAN映射一個MSTP實例,具體配置方法請參見“二層技術-以太網交換配置指導”中的“生成樹”。
(1) 配置各接口的IP地址
按照圖1-14配置各接口IP地址和掩碼,包括Loopback接口,具體配置過程略。
(2) 配置OSPF
在各台交換機上配置OSPF,以保證各交換機之間路由可達,具體配置過程略。
(3) 配置OSPF快速重路由
OSPF快速重路由有兩種配置方法,可以任選一種。
方法一:使能Switch S和Switch D的OSPF快速重路由功能(通過LFA算法選取備份下一跳信息)
# 配置Switch S。
<SwitchS> system-view
[SwitchS] bfd echo-source-ip 10.10.10.10
[SwitchS] ospf 1
[SwitchS-ospf-1] fast-reroute lfa
[SwitchS-ospf-1] quit
# 配置Switch D。
<SwitchD> system-view
[SwitchD] bfd echo-source-ip 11.11.11.11
[SwitchD] ospf 1
[SwitchD-ospf-1] fast-reroute lfa
[SwitchD-ospf-1] quit
方法二:使能Switch S和Switch D的OSPF快速重路由功能(通過路由策略指定備份下一跳)
# 配置Switch S。
<SwitchS> system-view
[SwitchS] bfd echo-source-ip 10.10.10.10
[SwitchS] ip prefix-list abc index 10 permit 21.1.1.0 24
[SwitchS] route-policy frr permit node 10
[SwitchS-route-policy-frr-10] if-match ip address prefix-list abc
[SwitchS-route-policy-frr-10] apply fast-reroute backup-interface vlan-interface 12 backup-nexthop 12.12.12.2
[SwitchS-route-policy-frr-10] quit
[SwitchS] ospf 1
[SwitchS-ospf-1] fast-reroute route-policy frr
[SwitchS-ospf-1] quit
# 配置Switch D。
<SwitchD> system-view
[SwitchD] bfd echo-source-ip 10.10.10.10
[SwitchD] ip prefix-list abc index 10 permit 11.1.1.0 24
[SwitchD] route-policy frr permit node 10
[SwitchD-route-policy-frr-10] if-match ip address prefix-list abc
[SwitchD-route-policy-frr-10] apply fast-reroute backup-interface vlan-interface 24 backup-nexthop 24.24.24.2
[SwitchD-route-policy-frr-10] quit
[SwitchD] ospf 1
[SwitchD-ospf-1] fast-reroute route-policy frr
[SwitchD-ospf-1] quit
(4) 使能MPLS和MPLS LDP功能
# 配置Switch S。
[SwitchS] mpls lsr-id 1.1.1.1
[SwitchS] mpls ldp
[SwitchS-mpls-ldp] quit
[SwitchS] interface vlan-interface 12
[SwitchS-Vlan-interface12] mpls enable
[SwitchS-Vlan-interface12] mpls ldp enable
[SwitchS-Vlan-interface12] quit
[SwitchS] interface vlan-interface 13
[SwitchS-Vlan-interface13] mpls enable
[SwitchS-Vlan-interface13] mpls ldp enable
[SwitchS-Vlan-interface13] quit
# 配置Switch D。
[SwitchD] mpls lsr-id 3.3.3.3
[SwitchD] mpls ldp
[SwitchD-mpls-ldp] quit
[SwitchD] interface vlan-interface 13
[SwitchD-Vlan-interface13] mpls enable
[SwitchD-Vlan-interface13] mpls ldp enable
[SwitchD-Vlan-interface13] quit
[SwitchD] interface vlan-interface 24
[SwitchD-Vlan-interface24] mpls enable
[SwitchD-Vlan-interface24] mpls ldp enable
[SwitchD-Vlan-interface24] quit
# 配置Switch A。
[SwitchA] mpls lsr-id 2.2.2.2
[SwitchA] mpls ldp
[SwitchA-mpls-ldp] quit
[SwitchA] interface vlan-interface 12
[SwitchA-Vlan-interface12] mpls enable
[SwitchA-Vlan-interface12] mpls ldp enable
[SwitchA-Vlan-interface12] quit
[SwitchA] interface vlan-interface 24
[SwitchA-Vlan-interface24] mpls enable
[SwitchA-Vlan-interface24] mpls ldp enable
[SwitchA-Vlan-interface24] quit
(5) 配置LSP的觸發建立策略為所有靜態路由和IGP路由項都能觸發LDP建立LSP
# 配置Switch S。
[SwitchS] mpls ldp
[SwitchS-ldp] lsp-trigger all
[SwitchS-ldp] quit
# 配置Switch D。
[SwitchD] mpls ldp
[SwitchD-ldp] lsp-trigger all
[SwitchD-ldp] quit
# 配置Switch A。
[SwitchA] mpls ldp
[SwitchA-ldp] lsp-trigger all
[SwitchA-ldp] quit
# 在Switch S和Switch D上執行display mpls ldp lsp命令,可以看到Switch S和Switch D之間建立了主備LSP(在Out Label後存在“B”,表示該LSP為備份LSP)。以Switch S為例:
[SwitchS] display mpls ldp lsp 21.1.1.0 24
Status Flags: * - stale, L - liberal, B - backup, N/A – unavailable
FECs: 1 Ingress: 2 Transit: 2 Egress: 0
FEC In/Out Label Nexthop OutInterface/LSINDEX
21.1.1.0/24 -/3 13.13.13.2 Vlan13
2174/3 13.13.13.2 Vlan13
-/3(B) 12.12.12.2 Vlan12
2174/3(B) 12.12.12.2 Vlan12
(0)
暫無評論
親~登錄後才可以操作哦!
確定你的郵箱還未認證,請認證郵箱或綁定手機後進行當前操作
舉報
×
侵犯我的權益
×
侵犯了我企業的權益
×
抄襲了我的內容
×
原文鏈接或出處
誹謗我
×
對根叔社區有害的內容
×
不規範轉載
×
舉報說明
暫無評論