在華爲設備中配置Hub&Spoke

在華爲設備中配置Hub&Spoke  
若是但願在×××中設置中心訪問控制設備,其它用戶的互訪都經過中心訪問控制設備進行,可使用Hub&Spoke組網方案,使得Spoke站點之間的通訊經過Hub站點進行。其中,中心訪問控制設備所在站點稱爲Hub站點,其餘用戶站點稱爲Spoke站點。Hub站點側接入×××骨幹網的設備叫Hub-CE;Spoke站點側接入×××骨幹網的設備叫Spoke-CE。×××骨幹網側接入Hub站點的設備叫Hub-PE,接入Spoke站點的設備叫Spoke-PE。
 
  • 每一個Spoke-PE上配置一個IPv6 ×××實例;Hub-PE需配置兩個IPv6 ×××實例(例如,***-in和***-out):***-in用於接收並維護全部Spoke-PE發佈的×××-IPv6路由;***-out用於維護Hub站點及全部Spoke站點的路由,併發布給全部Spoke-PE。
  • Hub-PE上須要使用兩個接口或子接口:一個綁定***-in,另外一個綁定***-out。
  • ×××-Target的配置規則爲:
    • ***-in的Import ×××-Target屬性列表包括全部Spoke-PE的Export ×××-Target屬性值。
    • ***-out的Export ×××-Target屬性列表包括全部Spoke-PE的Import ×××-Target屬性值。
    • ***-out的Export ×××-Target屬性列表與***-in的Import ×××-Target屬性列表不能有相同屬性值。
    • ***-out的Import ×××-Target屬性列表與***-in的Export ×××-Target屬性列表也不能有相同的屬性值。
建議不配置***-in的Export ×××-Target和***-out的Import ×××-Target。默認狀況下,×××實例沒有Export ×××-Target和Import ×××-Target屬性。
  • Hub-PE與Spoke-PE之間創建隧道和IBGP對等體關係;Spoke-PE之間不創建隧道和IBGP對等體關係,不交換×××路由信息。
 
注意×××-Target的配置規則。
當Hub-CE與Hub-PE之間使用EBGP時,Hub-PE上必須手工配置容許本地AS編號重複(在BGP-×××v4地址族視圖下配置命令 peer { ip-address | group-name } allow-as-loop [ number ])。
若是Spoke-PE與Spoke-CE使用EBGP,則Hub-CE與Hub-PE可使用EBGP或默認路由,但不能使用IGP。
配置實例一 組網需求
以下圖,Spoke-CE之間的通訊經過中心站點Hub-CE控制,即Spoke-CE之間的流量通過Hub-CE轉發,而不是隻通過Hub-PE轉發。要求Hub-CE與Hub-PE之間,Spoke-PE與Spoke-CE之間都使用EBGP交換路由信息。
p_w_picpath
 
適用產品和版本
採用NE系列路由器,版本爲(VRP5.30)及後續版本。
說明
  • PE路由器推薦採用NE80E、NE40E、NE80、NE40、NE20E、NE20、NE16E或NE08E。
  • CE路由器推薦採用NE80、NE40、NE20E、NE20、NE16E、NE08E或NE05。
配置步驟
步驟 1     在骨幹網上配置IGP協議,實現骨幹網Hub-PE和Spoke-PE的互通
本例中採用OSPF,具體配置過程略。
配置完成後,PE之間應能創建OSPF鄰居關係,執行 display ospf peer命令能夠看到鄰居狀態爲Full。執行 display ip routing-table命令能夠看到PE之間學習到對方的Loopback路由。
步驟 2     在骨幹網上配置MPLS基本能力和MPLS LDP,創建LDP LSP
具體配置過程略。
配置完成後,Hub-PE和Spoke-PE之間應該創建起LDP對等體關係,在各路由器上執行 display mpls ldp session命令能夠看到顯示結果中Session State項爲「Operational」。
步驟 3     在各PE路由器上配置×××實例,將CE接入PE
說明
注意Hub-PE與Spoke-PE上的××× Target屬性設置。
Hub-PE的兩個×××實例的×××-target分別爲兩個Spoke-PE發佈的×××-target,且發佈的×××-target與接收的×××-target不一樣。Spoke-PE的×××實例引入的×××-target爲Hub-PE發佈的×××-target。
# 配置Spoke-PE1。
[Spoke-PE1] ip ***-instance ***a
[Spoke-PE1-***-instance-***a] route-distinguisher 100:1
[Spoke-PE1-***-instance-***a] ***-target 100:1 ex port-extcommunity
[Spoke-PE1-***-instance-***a] ***-target 200:1 import-extcommunity
[Spoke-PE1-***-instance-***a] quit
[Spoke-PE1] interface gigabitethernet 1/0/0
[Spoke-PE1-GigabitEthernet1/0/0] ip binding ***-instance ***a
[Spoke-PE1-GigabitEthernet1/0/0] ip address 100.1.1.2 24
[Spoke-PE1-GigabitEthernet1/0/0] quit
# 配置Spoke-PE2。
[Spoke-PE2] ip ***-instance ***a
[Spoke-PE2-***-instance-***a] route-distinguisher 100:3
[Spoke-PE2-***-instance-***a] ***-target 100:1 ex port-extcommunity
[Spoke-PE2-***-instance-***a] ***-target 200:1 import-extcommunity
[Spoke-PE2-***-instance-***a] quit
[Spoke-PE2] interface gigabitethernet 1/0/0
[Spoke-PE2-GigabitEthernet1/0/0] ip binding ***-instance ***a
[Spoke-PE2-GigabitEthernet1/0/0] ip address 120.1.1.2 24
[Spoke-PE2-GigabitEthernet1/0/0] quit
# 配置Hub-PE。
[Hub-PE] ip ***-instance ***_in
[Hub-PE-***-instance-***_in] route-distinguisher 100:21
[Hub-PE-***-instance-***_in] ***-target 100:1 import-extcommunity
[Hub-PE-***-instance-***_in] quit
[Hub-PE] ip ***-instance ***_out
[Hub-PE-***-instance-***_out] route-distinguisher 100:22
[Hub-PE-***-instance-***_out] ***-target 200:1 ex port-extcommunity
[Hub-PE-***-instance-***_out] quit
[Hub-PE] interface gigabitethernet 3/0/0
[Hub-PE-GigabitEthernet3/0/0] ip binding ***-instance ***_in
[Hub-PE-GigabitEthernet3/0/0] ip address 110.1.1.2 24
[Hub-PE-GigabitEthernet3/0/0] quit
[Hub-PE] interface gigabitethernet 4/0/0
[Hub-PE-GigabitEthernet4/0/0] ip binding ***-instance ***_out
[Hub-PE-GigabitEthernet4/0/0] ip address 110.2.1.2 24
[Hub-PE-GigabitEthernet4/0/0] quit
# 按圖1-1配置各CE的接口IP地址,配置過程略。
配置完成後,在PE路由器上執行 display ip ***-instance verbose命令能夠看到×××實例的配置狀況。各PE能用命令 ping -***-instance ***-name ip-address ping通本身接入的CE。
說明
當PE上有多個綁定了同一個×××的接口,則使用 ping -***-instance 命令ping對端PE接入的CE時,要指定源IP地址,即要指定 ping -***-instance ***-instance-name -a source-ip-address dest-ip-address命令中的參數 -a source-ip-address,不然可能ping不通。
步驟 4     在PE與CE之間創建EBGP對等體關係,引入×××路由
說明
Hub-PE上須要配置容許AS號重複一次,以接收Hub-CE發佈的路由。
# 配置Spoke-CE1。
[Spoke-CE1] bgp 65410
[Spoke-CE1-bgp] peer 100.1.1.2 as-number 100
[Spoke-CE1-bgp] import-route direct
[Spoke-CE1-bgp] quit
# 配置Spoke-PE1。
[Spoke-PE1] bgp 100
[Spoke-PE1-bgp] ipv4-family ***-instance ***a
[Spoke-PE1-bgp-***a] peer 100.1.1.1 as-number 65410
[Spoke-PE1-bgp-***a] import-route direct
[Spoke-PE1-bgp-***a] quit
[Spoke-PE1-bgp] quit
# 配置Spoke-CE2。
[Spoke-CE2] bgp 65420
[Spoke-CE2-bgp] peer 120.1.1.2 as-number 100
[Spoke-CE2-bgp] import-route direct
[Spoke-CE2-bgp] quit
# 配置Spoke-PE2。
[Spoke-PE2] bgp 100
[Spoke-PE2-bgp] ipv4-family ***-instance ***a
[Spoke-PE2-bgp-***a] peer 120.1.1.1 as-number 65420
[Spoke-PE2-bgp-***a] import-route direct
[Spoke-PE2-bgp-***a] quit
[Spoke-PE2-bgp] quit
# 配置Hub-CE。
[Hub-CE] bgp 65430
[Hub-CE-bgp] peer 110.1.1.2 as-number 100
[Hub-CE-bgp] peer 110.2.1.2 as-number 100
[Hub-CE-bgp] import-route direct
[Hub-CE-bgp] quit
# 配置Hub-PE。
[Hub-PE] bgp 100
[Hub-PE-bgp] ipv4-family ***-instance ***_in
[Hub-PE-bgp-***_in] peer 110.1.1.1 as-number 65430
[Hub-PE-bgp-***_in] import-route direct
[Hub-PE-bgp-***_in] quit
[Hub-PE-bgp] ipv4-family ***-instance ***_out
[Hub-PE-bgp-***_out] peer 110.2.1.1 as-number 65430
[Hub-PE-bgp-***_out] peer 110.2.1.1 allow-as-loop 1
[Hub-PE-bgp-***_out] import-route direct
[Hub-PE-bgp-***_out] quit
[Hub-PE-bgp] quit
配置完成後,在各PE路由器上執行 display bgp ***v4 all peer命令,能夠看到PE與CE之間的BGP對等體關係已創建,並達到Established狀態。
步驟 5     在PE之間創建MP-IBGP對等體關係
說明
Spoke-PE上不須要配置容許AS號重複一次,由於路由器接收IBGP對等體發佈的路由時並不檢查其中的AS-PATH屬性。
# 配置Spoke-PE1。
[Spoke-PE1] bgp 100
[Spoke-PE1-bgp] peer 2.2.2.9 as-number 100
[Spoke-PE1-bgp] peer 2.2.2.9 connect-interface loopback 1
[Spoke-PE1-bgp] ipv4-family ***v4
[Spoke-PE1-bgp-af-***v4] peer 2.2.2.9 enable
[Spoke-PE1-bgp-af-***v4] quit
# 配置Spoke-PE2。
[Spoke-PE2] bgp 100
[Spoke-PE2-bgp] peer 2.2.2.9 as-number 100
[Spoke-PE2-bgp] peer 2.2.2.9 connect-interface loopback 1
[Spoke-PE2-bgp] ipv4-family ***v4
[Spoke-PE2-bgp-af-***v4] peer 2.2.2.9 enable
[Spoke-PE2-bgp-af-***v4] quit
# 配置Hub-PE。
[Hub-PE] bgp 100
[Hub-PE-bgp] peer 1.1.1.9 as-number 100
[Hub-PE-bgp] peer 1.1.1.9 connect-interface loopback 1
[Hub-PE-bgp] peer 3.3.3.9 as-number 100
[Hub-PE-bgp] peer 3.3.3.9 connect-interface loopback 1
[Hub-PE-bgp] ipv4-family ***v4
[Hub-PE-bgp-af-***v4] peer 1.1.1.9 enable
[Hub-PE-bgp-af-***v4] peer 3.3.3.9 enable
[Hub-PE-bgp-af-***v4] quit
配置完成後,在各PE路由器上執行 display bgp peerdisplay bgp ***v4 all peer命令,能夠看到PE之間的BGP對等體關係已創建,並達到Established狀態。
驗證結果
完成上述配置後,Spoke-CE之間能夠相互Ping通,使用Tracert能夠看到Spoke-CE之間的流量通過Hub-CE轉發,也能夠經過Ping結果中的TTL值推算Spoke-CE之間通過的轉發設備數目。
以Spoke-CE1的顯示爲例:
[Spoke-CE1] ping 120.1.1.1
  PING 120.1.1.1: 56  data bytes, press CTRL_C to break
    Reply from 120.1.1.1: bytes=56 Sequence=1 ttl=250 time=80 ms
    Reply from 120.1.1.1: bytes=56 Sequence=2 ttl=250 time=129 ms
    Reply from 120.1.1.1: bytes=56 Sequence=3 ttl=250 time=132 ms
    Reply from 120.1.1.1: bytes=56 Sequence=4 ttl=250 time=92 ms
    Reply from 120.1.1.1: bytes=56 Sequence=5 ttl=250 time=126 ms
  --- 120.1.1.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 80/111/132 ms
[Spoke-CE1] tracert 120.1.1.1
traceroute to  120.1.1.1(120.1.1.1) 30 hops max,40 bytes packet
1 100.1.1.2 24 ms  19 ms  11 ms
2 110.2.1.2 87 ms  60 ms  58 ms
3 110.2.1.1 59 ms  27 ms  53 ms
4 110.1.1.2 41 ms  34 ms  56 ms
5 120.1.1.2 90 ms  66 ms  75 ms
6 120.1.1.1 143 ms  96 ms  90 ms
在Spoke-CE上執行 display bgp routing-table命令,能夠看到去往對端Spoke-CE的BGP路由的AS路徑中存在重複的AS號。
以Spoke-CE1的顯示爲例:
[Spoke-CE1] display bgp routing-table
Total Number of Routes: 6
BGP Local router ID is 100.1.1.1
Status codes: * - valid, > - best, d - damped,
              h - history,  i - internal, s - suppressed, S - Stale
              Origin : i - IGP, e - EGP, ? - incomplete
     Network         NextHop      MED    LocPrf    PrefVal Path/Ogn
*>  100.1.1.0/24    0.0.0.0       0                 0      ?
*                   100.1.1.2     0                 0      100?
*>  100.1.1.1/32    0.0.0.0       0                 0      ?
*>  110.1.1.0/24    100.1.1.2                       0      100 65430?
*>  110.2.1.0/24    100.1.1.2                       0      100?
*>  120.1.1.0/24    100.1.1.2                       0      100 65430 100?
配置文件
  • Hub-CE的配置文件
#
sysname Hub-CE
#
interface GigabitEthernet1/0/0
ip address 110.1.1.1 255.255.255.0
#
interface GigabitEthernet2/0/0
ip address 110.2.1.1 255.255.255.0
#
bgp 65430
peer 110.1.1.2 as-number 100
peer 110.2.1.2 as-number 100
#
ipv4-family unicast
  undo synchronization
  import-route direct
  peer 110.2.1.2 enable
  peer 110.1.1.2 enable
#
return
  • Hub-PE的配置文件
#
sysname Hub-PE
#
ip ***-instance ***_in
route-distinguisher 100:21
***-target 100:1 import-extcommunity
#
ip ***-instance ***_out
route-distinguisher 100:22
***-target 200:1 export-extcommunity
#
mpls lsr-id 2.2.2.9
mpls
  lsp-trigger all
#
mpls ldp
#
interface GigabitEthernet3/0/0
ip binding ***-instance ***_in
ip address 110.1.1.2 255.255.255.0
#
interface GigabitEthernet4/0/0
ip binding ***-instance ***_out
ip address 110.2.1.2 255.255.255.0
#
interface Pos1/0/0
link-protocol ppp
ip address 10.1.1.2 255.255.255.0
mpls
mpls ldp
#
interface Pos2/0/0
link-protocol ppp
ip address 11.1.1.2 255.255.255.0
mpls
mpls ldp
#
interface LoopBack1
ip address 2.2.2.9 255.255.255.255
#
bgp 100
peer 1.1.1.9 as-number 100
peer 3.3.3.9 as-number 100
peer 1.1.1.9 connect-interface LoopBack1
peer 3.3.3.9 connect-interface LoopBack1
#
ipv4-family unicast
  undo synchronization
  peer 1.1.1.9 enable
  peer 3.3.3.9 enable
#
ipv4-family ***v4
  policy ***-target
  peer 1.1.1.9 enable
  peer 3.3.3.9 enable
#
ipv4-family ***-instance ***_in
  peer 110.1.1.1 as-number 65430
  import-route direct
#
ipv4-family ***-instance ***_out
  peer 110.2.1.1 as-number 65430
  peer 110.2.1.1 allow-as-loop
  import-route direct
#
ospf 1
area 0.0.0.0
  network 2.2.2.9 0.0.0.0
  network 10.1.1.0 0.0.0.255
  network 11.1.1.0 0.0.0.255
#
return
  • Spoke-CE1的配置文件
#
sysname Spoke-CE1
#
interface GigabitEthernet1/0/0
ip address 100.1.1.1 255.255.255.0
#
interface NULL0
#
bgp 65410
peer 100.1.1.2 as-number 100
#
ipv4-family unicast
  undo synchronization
  import-route direct
  peer 100.1.1.2 enable
#
return
  • Spoke-PE1的配置文件
#
sysname Spoke-PE1
#
ip ***-instance ***a
route-distinguisher 100:1
***-target 100:1 export-extcommunity
***-target 200:1 import-extcommunity
#
mpls lsr-id 1.1.1.9
mpls
  lsp-trigger all
#
mpls ldp
#
interface GigabitEthernet1/0/0
ip binding ***-instance ***a
ip address 100.1.1.2 255.255.255.0
#
interface Pos2/0/0
link-protocol ppp
ip address 10.1.1.1 255.255.255.0
mpls
mpls ldp
#
interface LoopBack1
ip address 1.1.1.9 255.255.255.255
#
bgp 100
peer 2.2.2.9 as-number 100
peer 2.2.2.9 connect-interface LoopBack1
#
ipv4-family unicast
  undo synchronization
  peer 2.2.2.9 enable
#
ipv4-family ***v4
  policy ***-target
  peer 2.2.2.9 enable
#
ipv4-family ***-instance ***a
  peer 100.1.1.1 as-number 65410
  import-route direct
#
ospf 1
area 0.0.0.0
  network 10.1.1.0 0.0.0.255
  network 1.1.1.9 0.0.0.0
#
return
  • Spoke-PE2的配置文件
#
sysname Spoke-PE2
#
ip ***-instance ***a
route-distinguisher 100:3
***-target 100:1 export-extcommunity
***-target 200:1 import-extcommunity
#
mpls lsr-id 3.3.3.9
mpls
  lsp-trigger all
#
mpls ldp
#
interface GigabitEthernet1/0/0
ip binding ***-instance ***a
ip address 120.1.1.2 255.255.255.0
#
interface Pos2/0/0
link-protocol ppp
ip address 11.1.1.1 255.255.255.0
mpls
mpls ldp
#
interface LoopBack1
ip address 3.3.3.9 255.255.255.255
#
bgp 100
peer 2.2.2.9 as-number 100
peer 2.2.2.9 connect-interface LoopBack1
#
ipv4-family unicast
  undo synchronization
  peer 2.2.2.9 enable
#
ipv4-family ***v4
  policy ***-target
  peer 2.2.2.9 enable
#
ipv4-family ***-instance ***a
  peer 120.1.1.1 as-number 65420
  import-route direct
#
ospf 1
area 0.0.0.0
  network 3.3.3.9 0.0.0.0
  network 11.1.1.0 0.0.0.255
#
return
  • Spoke-CE2的配置文件
#
sysname Spoke-CE2
#
interface GigabitEthernet1/0/0
ip address 120.1.1.1 255.255.255.0
#
bgp 65420
peer 120.1.1.2 as-number 100
#
ipv4-family unicast
  undo synchronization
  import-route direct
  peer 120.1.1.2 enable
#
Return
配置實例二 組網需求
如上例中的圖,Spoke-CE之間的通訊經過中心站點Hub-CE控制,即Spoke-CE之間的流量通過Hub-CE轉發,而不是隻通過Hub-PE轉發。要求Hub-CE與Hub-PE之間使用默認路由,Spoke-PE與Spoke-CE之間使用EBGP交換路由信息。
適用產品和版本
CE設備使用NE0五、NE08E或NE16E;
PE設備使用NE20、NE40N、E40E或NE80E。
配置步驟
步驟 1     在骨幹網上配置IGP協議,實現骨幹網Hub-PE和Spoke-PE的互通
本例中採用OSPF,具體配置過程略。
配置完成後,PE之間應能創建OSPF鄰居關係,執行 display ospf peer命令能夠看到鄰居狀態爲Full。執行 display ip routing-table命令能夠看到PE之間學習到對方的Loopback路由。
步驟 2     在骨幹網上配置MPLS基本能力和MPLS LDP,創建LDP LSP
具體配置過程略。
配置完成後,Hub-PE和Spoke-PE之間應該創建起LDP對等體關係,在各路由器上執行 display mpls ldp session命令能夠看到顯示結果中Session State項爲「Operational」。
步驟 3     在各PE路由器上配置×××實例,將CE接入PE
說明
注意Hub-PE與Spoke-PE上的××× Target屬性設置。
Hub-PE的兩個×××實例的×××-target分別爲兩個Spoke-PE發佈的×××-target,且發佈的×××-target與接收的×××-target不一樣。Spoke-PE的×××實例引入的×××-target爲Hub-PE發佈的×××-target。
# 配置Spoke-PE1。
[Spoke-PE1] ip ***-instance ***a
[Spoke-PE1-***-instance-***a] route-distinguisher 100:1
[Spoke-PE1-***-instance-***a] ***-target 100:1 ex port-extcommunity
[Spoke-PE1-***-instance-***a] ***-target 200:1 import-extcommunity
[Spoke-PE1-***-instance-***a] quit
[Spoke-PE1] interface gigabitethernet 1/0/0
[Spoke-PE1-GigabitEthernet1/0/0] ip binding ***-instance ***a
[Spoke-PE1-GigabitEthernet1/0/0] ip address 100.1.1.2 24
[Spoke-PE1-GigabitEthernet1/0/0] quit
# 配置Spoke-PE2。
[Spoke-PE2] ip ***-instance ***a
[Spoke-PE2-***-instance-***a] route-distinguisher 100:3
[Spoke-PE2-***-instance-***a] ***-target 100:1 ex port-extcommunity
[Spoke-PE2-***-instance-***a] ***-target 200:1 import-extcommunity
[Spoke-PE2-***-instance-***a] quit
[Spoke-PE2] interface gigabitethernet 1/0/0
[Spoke-PE2-GigabitEthernet1/0/0] ip binding ***-instance ***a
[Spoke-PE2-GigabitEthernet1/0/0] ip address 120.1.1.2 24
[Spoke-PE2-GigabitEthernet1/0/0] quit
# 配置Hub-PE。
[Hub-PE] ip ***-instance ***_in
[Hub-PE-***-instance-***_in] route-distinguisher 100:21
[Hub-PE-***-instance-***_in] ***-target 100:1 import-extcommunity
[Hub-PE-***-instance-***_in] quit
[Hub-PE] ip ***-instance ***_out
[Hub-PE-***-instance-***_out] route-distinguisher 100:22
[Hub-PE-***-instance-***_out] ***-target 200:1 ex port-extcommunity
[Hub-PE-***-instance-***_out] quit
[Hub-PE] interface gigabitethernet 3/0/0
[Hub-PE-GigabitEthernet3/0/0] ip binding ***-instance ***_in
[Hub-PE-GigabitEthernet3/0/0] ip address 110.1.1.2 24
[Hub-PE-GigabitEthernet3/0/0] quit
[Hub-PE] interface gigabitethernet 4/0/0
[Hub-PE-GigabitEthernet4/0/0] ip binding ***-instance ***_out
[Hub-PE-GigabitEthernet4/0/0] ip address 110.2.1.2 24
[Hub-PE-GigabitEthernet4/0/0] quit
# 按上圖配置各CE的接口IP地址,配置過程略。
配置完成後,在PE路由器上執行 display ip ***-instance verbose命令能夠看到×××實例的配置狀況。各PE能用命令 ping -***-instance ***-name ip-address ping通本身接入的CE。
說明
當PE上有多個綁定了同一個×××的接口,則使用 ping -***-instance 命令ping對端PE接入的CE時,要指定源IP地址,即要指定 ping -***-instance ***-instance-name -a source-ip-address dest-ip-address命令中的參數 -a source-ip-address,不然可能ping不通。
步驟 4     在PE之間創建MP-IBGP對等體關係
說明
Spoke-PE上不須要配置容許AS號重複一次,由於路由器接收IBGP對等體發佈的路由時並不檢查其中的AS-PATH屬性。
# 配置Spoke-PE1。
[Spoke-PE1] bgp 100
[Spoke-PE1-bgp] peer 2.2.2.9 as-number 100
[Spoke-PE1-bgp] peer 2.2.2.9 connect-interface loopback 1
[Spoke-PE1-bgp] ipv4-family ***v4
[Spoke-PE1-bgp-af-***v4] peer 2.2.2.9 enable
[Spoke-PE1-bgp-af-***v4] quit
# 配置Spoke-PE2。
[Spoke-PE2] bgp 100
[Spoke-PE2-bgp] peer 2.2.2.9 as-number 100
[Spoke-PE2-bgp] peer 2.2.2.9 connect-interface loopback 1
[Spoke-PE2-bgp] ipv4-family ***v4
[Spoke-PE2-bgp-af-***v4] peer 2.2.2.9 enable
[Spoke-PE2-bgp-af-***v4] quit
# 配置Hub-PE。
[Hub-PE] bgp 100
[Hub-PE-bgp] peer 1.1.1.9 as-number 100
[Hub-PE-bgp] peer 1.1.1.9 connect-interface loopback 1
[Hub-PE-bgp] peer 3.3.3.9 as-number 100
[Hub-PE-bgp] peer 3.3.3.9 connect-interface loopback 1
[Hub-PE-bgp] ipv4-family ***v4
[Hub-PE-bgp-af-***v4] peer 1.1.1.9 enable
[Hub-PE-bgp-af-***v4] peer 3.3.3.9 enable
[Hub-PE-bgp-af-***v4] quit
配置完成後,在各PE路由器上執行 display bgp peerdisplay bgp ***v4 all peer命令,能夠看到PE之間的BGP對等體關係已創建,並達到Established狀態。
步驟 5     在Spoke-PE與Spoke-CE之間創建EBGP對等體關係,引入×××路由
# 配置Spoke-CE1。
[Spoke-CE1] bgp 65410
[Spoke-CE1-bgp] peer 100.1.1.2 as-number 100
[Spoke-CE1-bgp] import-route direct
[Spoke-CE1-bgp] quit
# 配置Spoke-PE1。
[Spoke-PE1] bgp 100
[Spoke-PE1-bgp] ipv4-family ***-instance ***a
[Spoke-PE1-bgp-***a] peer 100.1.1.1 as-number 65410
[Spoke-PE1-bgp-***a] import-route direct
[Spoke-PE1-bgp-***a] quit
[Spoke-PE1-bgp] quit
# 配置Spoke-CE2。
[Spoke-CE2] bgp 65420
[Spoke-CE2-bgp] peer 120.1.1.2 as-number 100
[Spoke-CE2-bgp] import-route direct
[Spoke-CE2-bgp] quit
# 配置Spoke-PE2。
[Spoke-PE2] bgp 100
[Spoke-PE2-bgp] ipv4-family ***-instance ***a
[Spoke-PE2-bgp-***a] peer 120.1.1.1 as-number 65420
[Spoke-PE2-bgp-***a] import-route direct
[Spoke-PE2-bgp-***a] quit
[Spoke-PE2-bgp] quit
配置完成後,在各Spoke-PE路由器上執行 display bgp ***v4 all peer命令,能夠看到Spoke-PE與其接入的Spoke-CE之間的EBGP對等體關係已創建,並達到Established狀態。
步驟 6     在Hub-PE與Hub-CE上配置默認路由
# 配置Hub-CE。
[Hub-CE] ip route-static 0.0.0 .0 0 110.2.1.2
# 配置Hub-PE。
# 爲***_out配置默認路由,下一跳爲Hub-CE。
[Hub-PE] ip route-static ***-instance ***_out 0.0.0.0 0 110.2.1.1
# 經過MP-IBGP發佈該默認路由。
[Hub-PE] bgp 100
[Hub-PE-bgp] ipv4-family ***-instance ***_out
[Hub-PE-bgp-***_out] network 0.0.0.0 0
# 經過MP-IBGP發佈直連路由。
[Hub-PE-bgp-***_out] import-route direct
[Hub-PE-bgp-***_out] quit
[Hub-PE-bgp] quit
驗證結果
完成上述配置後,在Spoke-PE上執行命令 display bgp ***v4 all routing-table查看BGP ×××-IPv4路由,能夠發現Hub-PE上***_out的默認路由已發佈給各Spoke-PE。
Spoke-CE之間能夠相互Ping通,使用Tracert能夠看到Spoke-CE之間的流量通過Hub-CE轉發,也能夠經過Ping結果中的TTL值推算Spoke-CE之間通過的轉發設備數目。
在Spoke-CE上執行 display bgp ip routing-table命令,能夠看到對端Spoke-PE經過BGP發佈過來的默認路由。執行 display ip routing-table命令,可看到有默認路由,下一跳爲對端Spoke-PE。
配置文件
  • Hub-CE的配置文件
#
sysname Hub-CE
#
interface GigabitEthernet1/0/0
ip address 110.1.1.1 255.255.255.0
#
interface GigabitEthernet2/0/0
ip address 110.2.1.1 255.255.255.0
#
ip route-static 0.0.0.0 0 110.2.1.2
#
return
  • Hub-PE的配置文件
#
sysname Hub-PE
#
ip ***-instance ***_in
route-distinguisher 100:21
***-target 100:1 import-extcommunity
#
ip ***-instance ***_out
route-distinguisher 100:22
***-target 200:1 export-extcommunity
#
mpls lsr-id 2.2.2.9
mpls
  lsp-trigger all
#
mpls ldp
#
interface GigabitEthernet3/0/0
ip binding ***-instance ***_in
ip address 110.1.1.2 255.255.255.0
#
interface GigabitEthernet4/0/0
ip binding ***-instance ***_out
ip address 110.2.1.2 255.255.255.0
#
interface Pos1/0/0
link-protocol ppp
ip address 10.1.1.2 255.255.255.0
mpls
mpls ldp
#
interface Pos2/0/0
link-protocol ppp
ip address 11.1.1.2 255.255.255.0
mpls
mpls ldp
#
interface LoopBack1
ip address 2.2.2.9 255.255.255.255
#
bgp 100
peer 1.1.1.9 as-number 100
peer 3.3.3.9 as-number 100
peer 1.1.1.9 connect-interface LoopBack1
peer 3.3.3.9 connect-interface LoopBack1
#
ipv4-family unicast
  undo synchronization
  peer 1.1.1.9 enable
  peer 3.3.3.9 enable
#
ipv4-family ***v4
  policy ***-target
  peer 1.1.1.9 enable
  peer 3.3.3.9 enable
#
ipv4-family ***-instance ***_out
  network 0.0.0.0 0
  import-route direct
#
ospf 1
area 0.0.0.0
  network 2.2.2.9 0.0.0.0
  network 10.1.1.0 0.0.0.255
  network 11.1.1.0 0.0.0.255
#
ip route-static ***-instance ***_out 0.0.0.0 0 110.2.1.1
#
return
  • Spoke-CE1的配置文件
#
sysname Spoke-CE1
#
interface GigabitEthernet1/0/0
ip address 100.1.1.1 255.255.255.0
#
interface NULL0
#
bgp 65410
peer 100.1.1.2 as-number 100
#
ipv4-family unicast
  undo synchronization
  import-route direct
  peer 100.1.1.2 enable
#
return
  • Spoke-PE1的配置文件
#
sysname Spoke-PE1
#
ip ***-instance ***a
route-distinguisher 100:1
***-target 100:1 export-extcommunity
***-target 200:1 import-extcommunity
#
mpls lsr-id 1.1.1.9
mpls
  lsp-trigger all
#
mpls ldp
#
interface GigabitEthernet1/0/0
ip binding ***-instance ***a
ip address 100.1.1.2 255.255.255.0
#
interface Pos2/0/0
link-protocol ppp
ip address 10.1.1.1 255.255.255.0
mpls
mpls ldp
#
interface LoopBack1
ip address 1.1.1.9 255.255.255.255
#
bgp 100
peer 2.2.2.9 as-number 100
peer 2.2.2.9 connect-interface LoopBack1
#
ipv4-family unicast
  undo synchronization
  peer 2.2.2.9 enable
#
ipv4-family ***v4
  policy ***-target
  peer 2.2.2.9 enable
#
ipv4-family ***-instance ***a
  peer 100.1.1.1 as-number 65410
  import-route direct
#
ospf 1
area 0.0.0.0
  network 10.1.1.0 0.0.0.255
  network 1.1.1.9 0.0.0.0
#
return
  • Spoke-PE2的配置文件
#
sysname Spoke-PE2
#
ip ***-instance ***a
route-distinguisher 100:3
***-target 100:1 export-extcommunity
***-target 200:1 import-extcommunity
#
mpls lsr-id 3.3.3.9
mpls
  lsp-trigger all
#
mpls ldp
#
interface GigabitEthernet1/0/0
ip binding ***-instance ***a
ip address 120.1.1.2 255.255.255.0
#
interface Pos2/0/0
link-protocol ppp
ip address 11.1.1.1 255.255.255.0
mpls
mpls ldp
#
interface LoopBack1
ip address 3.3.3.9 255.255.255.255
#
bgp 100
peer 2.2.2.9 as-number 100
peer 2.2.2.9 connect-interface LoopBack1
#
ipv4-family unicast
  undo synchronization
  peer 2.2.2.9 enable
#
ipv4-family ***v4
  policy ***-target
  peer 2.2.2.9 enable
#
ipv4-family ***-instance ***a
  peer 120.1.1.1 as-number 65420
  import-route direct
#
ospf 1
area 0.0.0.0
  network 3.3.3.9 0.0.0.0
  network 11.1.1.0 0.0.0.255
#
return
  • Spoke-CE2的配置文件
#
sysname Spoke-CE2
#
interface GigabitEthernet1/0/0
ip address 120.1.1.1 255.255.255.0
#
bgp 65420
peer 120.1.1.2 as-number 100
#
ipv4-family unicast
  undo synchronization
  import-route direct
  peer 120.1.1.2 enable
#
return
相關文章
相關標籤/搜索