欢迎光临
我们一直在努力

MPLS Hub-Spoke场景以及OSPF双归防环

 1.实验拓扑结构

IMG_256

2.基本配置

a.配置公网IP地址,底层IGP协议(此处使用ISIS),配置MPLS LDP

AR1:

mpls lsr-id 1.1.1.1
mpls
mpls ldp

isis 1
 is-level level-2
 cost-style wide
 network-entity 49.0001.0000.0000.0001.00

interface GigabitEthernet0/0/1
 ip address 10.1.12.1 255.255.255.0 
 isis enable 1
 mpls
 mpls ldp

interface LoopBack0
 ip address 1.1.1.1 255.255.255.255 
 isis enable 1

AR2:

mpls lsr-id 2.2.2.2
mpls
mpls ldp

isis 1
 is-level level-2
 cost-style wide
 network-entity 49.0001.0000.0000.0002.00

interface GigabitEthernet0/0/0
 ip address 10.1.12.2 255.255.255.0 
 isis enable 1
 mpls
 mpls ldp

interface GigabitEthernet0/0/1
 ip address 10.1.23.2 255.255.255.0 
 isis enable 1
 mpls
 mpls ldp

interface GigabitEthernet0/0/2
 ip address 10.1.24.2 255.255.255.0 
 isis enable 1
 mpls
 mpls ldp

interface LoopBack0
 ip address 2.2.2.2 255.255.255.255 
 isis enable 1

AR3:

mpls lsr-id 3.3.3.3
mpls
mpls ldp

isis 1
 is-level level-2
 cost-style wide
 network-entity 49.0001.0000.0000.0003.00

interface GigabitEthernet0/0/0
 ip address 10.1.23.3 255.255.255.0 
 isis enable 1
 mpls
 mpls ldp

interface LoopBack0
 ip address 3.3.3.3 255.255.255.255 
 isis enable 1

AR4:

mpls lsr-id 4.4.4.4
mpls
mpls ldp

isis 1
 is-level level-2
 cost-style wide
 network-entity 49.0001.0000.0000.0004.00

interface GigabitEthernet0/0/0
 ip address 10.1.24.4 255.255.255.0 
 isis enable 1
 mpls
 mpls ldp

interface LoopBack0
 ip address 4.4.4.4 255.255.255.255 
 isis enable 1

检查基本配置是否正确:

使用display isis peer来检查邻居是否建立

使用display mpls lsp来查看是否为非物理接口主机路由建立LSP

IMG_258

IMG_260

 3.对接配置

Spoke1:

AR7:

interface GigabitEthernet0/0/0
 ip address 10.1.47.7 255.255.255.0

interface LoopBack0
 ip address 7.7.7.7 255.255.255.255  

bgp 100
 router-id 7.7.7.7
 peer 10.1.47.4 as-number 200 
 ipv4-family unicast
  network 7.7.7.7 255.255.255.255 
  peer 10.1.47.4 enable

AR4:

ip vpn-instance a
 ipv4-family
  route-distinguisher 1:1
  vpn-target 1:100 export
  vpn-target 1:200 import

interface GigabitEthernet0/0/1
 ip binding vpn-instance a
 ip address 10.1.47.4 255.255.255.0 

bgp 200
 ipv4-family unicast
 ipv4-family vpn-instance a 
  peer 10.1.47.7 as-number 100 

 检查配置是否正确:

IMG_262

IMG_264

Spoke2:

AR8:
ospf 1 router-id 8.8.8.8 
 area 0.0.0.0 
  network 8.8.8.8 0.0.0.0 
  network 10.1.68.0 0.0.0.255  

AR9:
ospf 1 router-id 9.9.9.9 
 area 0.0.0.0 
  network 9.9.9.9 0.0.0.0 

AR6:

interface GigabitEthernet0/0/0.1
 dot1q termination vid 10
 ip binding vpn-instance b
 ip address 10.1.36.6 255.255.255.0 
 arp broadcast enable

interface GigabitEthernet0/0/0.2
 dot1q termination vid 20
 ip binding vpn-instance c
 ip address 10.1.63.6 255.255.255.0 
 arp broadcast enable

interface GigabitEthernet0/0/1
 ip binding vpn-instance b
 ip address 10.1.68.6 255.255.255.0 

interface GigabitEthernet0/0/2
 ip binding vpn-instance c

interface LoopBack0
 ip address 6.6.6.6 255.255.255.255 

ospf 1 vpn-instance b
 area 0.0.0.0 
  network 10.1.36.0 0.0.0.255 
  network 10.1.68.0 0.0.0.255 

ospf 2 vpn-instance c
 area 0.0.0.0 
  network 10.1.63.0 0.0.0.255 
 

AR3:

ip vpn-instance b
  route-distinguisher 2:1
  vpn-target 2:100 export
  vpn-target 2:200 import

ip vpn-instance c
  route-distinguisher 2:2
  vpn-target 2:300 export
  vpn-target 2:400 import

interface GigabitEthernet0/0/1.1
 dot1q termination vid 10
 ip binding vpn-instance b
 ip address 10.1.36.3 255.255.255.0 
 arp broadcast en

interface GigabitEthernet0/0/1.2
 dot1q termination vid 20
 ip binding vpn-instance c
 ip address 10.1.63.3 255.255.255.0 
 arp broadcast en

ospf 1 vpn-instance b
 area 0.0.0.0 
  network 10.1.36.0 0.0.0.255 

ospf 2 vpn-instance c
 area 0.0.0.0 
  network 10.1.63.0 0.0.0.255 

 检查配置是否正确:

使用display ospf peer brief检查ospf邻居是否建立

使用display ip routing-table vpn-instance 检查是否学习到路由

IMG_266

IMG_268

IMG_270

Hub:

AR5:

interface GigabitEthernet0/0/0.1
 dot1q termination vid 10
 ip address 10.1.15.5 255.255.255.0 
 arp broadcast enable
#
interface GigabitEthernet0/0/0.2
 dot1q termination vid 20
 ip address 10.1.51.5 255.255.255.0 
 arp broadcast enable
#
interface LoopBack0
 ip address 5.5.5.5 255.255.255.255 
#
bgp 100
 router-id 5.5.5.5
 peer 10.1.15.1 as-number 200 
 peer 10.1.51.1 as-number 200 
 #
 ipv4-family unicast
  network 5.5.5.5 255.255.255.255 
  peer 10.1.15.1 enable
  peer 10.1.51.1 enable
 

AR1:

ip vpn-instance in
 ipv4-family
  route-distinguisher 3:1
  vpn-target 1:100 2:100 2:300 import-extcommunity
#
ip vpn-instance out
 ipv4-family
  route-distinguisher 3:2
  vpn-target 1:200 2:200 2:400 export-extcommunity
#
interface GigabitEthernet0/0/0.1
 dot1q termination vid 10
 ip binding vpn-instance in
 ip address 10.1.15.1 255.255.255.0 
 arp broadcast enable
#
interface GigabitEthernet0/0/0.2
 dot1q termination vid 20
 ip binding vpn-instance out
 ip address 10.1.51.1 255.255.255.0 
 arp broadcast enable
bgp 200
 router-id 1.1.1.1
 #
 ipv4-family vpn-instance in 
  peer 10.1.15.5 as-number 100 
 #
 ipv4-family vpn-instance out 
  peer 10.1.51.5 as-number 100 

检查配置是否正确:

使用display bgp vpnv4 all peer查看邻居是否建立

使用display bgp vpnv4 all routing-table来查看是否学习到总部路由

IMG_272

IMG_274

 5.建立公网BGP的vpnv4邻居(使用RR反射器)

AR1:

bgp 200
 router-id 1.1.1.1
 peer 2.2.2.2 as-number 200 
 peer 2.2.2.2 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 2.2.2.2 enable
 # 
 ipv4-family vpnv4
  policy vpn-target
  peer 2.2.2.2 enable

AR2:

bgp 200
 router-id 2.2.2.2
 peer 1.1.1.1 as-number 200 
 peer 1.1.1.1 connect-interface LoopBack0
 peer 3.3.3.3 as-number 200 
 peer 3.3.3.3 connect-interface LoopBack0
 peer 4.4.4.4 as-number 200 
 peer 4.4.4.4 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 1.1.1.1 enable
  peer 3.3.3.3 enable
  peer 4.4.4.4 enable
 # 
 ipv4-family vpnv4
  undo policy vpn-target
  peer 1.1.1.1 enable
  peer 1.1.1.1 reflect-client
  peer 3.3.3.3 enable
  peer 3.3.3.3 reflect-client
  peer 4.4.4.4 enable
  peer 4.4.4.4 reflect-client

AR3:

bgp 200
 router-id 3.3.3.3
 peer 2.2.2.2 as-number 200 
 peer 2.2.2.2 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 2.2.2.2 enable
 # 
 ipv4-family vpnv4
  policy vpn-target
  peer 2.2.2.2 enable

 #
 ipv4-family vpn-instance b 
  import-route ospf 1 route-policy vpnb
 #
 ipv4-family vpn-instance c 
  import-route ospf 2 route-policy vpnc

#
ospf 1 vpn-instance b
 import-route bgp route-policy 1

#
ospf 2 vpn-instance c
 import-route bgp route-policy 1

AR4:

bgp 200
 router-id 4.4.4.4
 peer 2.2.2.2 as-number 200 
 peer 2.2.2.2 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 2.2.2.2 enable
 # 
 ipv4-family vpnv4
  policy vpn-target
  peer 2.2.2.2 enable

检查配置是否正确:

使用display bgp vpnv4 all peer查看邻居是否建立

使用display bgp vpnv4 all routing-table来查看是否学习到总部路由

IMG_276

IMG_278

此时会发现CE或PE设备没有接收到BGP的vpnv4或ipv4 vpnv4 路由

6.Hub-Spoke的CE和PE之间的关键配置

 a.Hub的CE接收不到Spoke2的主机路由(7.7.7.7)

  原因:因为BGP路由从Spoke发出的时候打上as-path  100,此时Hub也是as-100,触发了BGP的防环机制,所以不接收路由

  解决方案:

     两种选一种即可

     peer 10.1.15.5 allow-as-loop(对邻居10.1.15.5传来的BGP路由允许本as出现多次)

     peer 10.1.15.5 subsititute(使用本地as号替换as-path的其他as号)

此时Hub(总部)的CE设备学习到分支所有路由

IMG_280

b.Hub的PE设备学习不到Spoke的BGP的vpnv4路由

 原因:因为BGP路由从Hub的PE发给CE的时候打上as-path  200,但是Hub的CE发给PE的时候as-path是由200的,触发了BGP的防环机制,所以不接收路由

  解决方案:

     两种选一种即可

     peer 10.1.51.1 allow-as-loop(对邻居10.1.15.5传来的BGP路由允许本as出现多次)

     peer 10.1.51.1 subsititute(使用本地as号替换as-path的其他as号)

此时Hub(总部)的PE的in实例和out实例学习到分支所有路由,并且Spoke的PE设备均收到Spoke和Hub的BGP vpnv4路由

IMG_282

IMG_284

IMG_286

c.Spoke2上的CE接收不到BGP路由

  原因:因为BGP路由as-path存在as100,触发了BGP防环机制

  解决方案:

     两种选一种即可

    CE:peer 10.1.47.4 allow-as-loop(对邻居10.1.15.5传来的BGP路由允许本as出现多次)

    PE:peer 10.1.47.7 subsititute(使用本地as号替换as-path的其他as号)

此时Spoke2可以收到Hub和Spoke1的路由

IMG_288

d.Spoke1的CE上的ospf收不到路由

原因:OSPF实例收到从BGP重分发的路由时,DN bit位会置位,DN bit位置位的路由,是不会接收的

解决方案:

  CE:ospf视图下vpn-instnace-capabnility simple(忽略DN bit位)

此时Spoke1都可以正常学习到路由

IMG_290

IMG_292

7.结果验证:

Spoke1f访问总部:

IMG_294

IMG_296

Spoke1访问Spoke2:

IMG_298

IMG_300

点击并拖拽以移动

8.总结:

a.路由传递过程:

IPv4路由——->IPv4 Intance 路由——->BGP Instance 路由——->BGP vpnv4路由——->BGP Instance 路由——->IPv4 Intance 路由——->IPv4路由

b.Hub-Spoke访问过程:

Hub和Spoke之间直接互访:

 数据包先封装私网标签,在封装公网标签,传递到Hub的PE设备先弹出公网标签,根据私网标签查找对应IPv4 Intance路由表进行路由转发

Spoke和Spoke之间互访回绕行总部:

  数据包先封装私网标签,在封装公网标签,传递到Hub的PE设备的Out实例先弹出公网标签,根据私网标签查找对应IPv4 Intance路由表进行路由转发,从Hub的CE发回Hub的PE设备,重新封装私网标签,在封装公网标签,发给Spoke,传递到Spoke的PE设备先弹出公网标签,根据私网标签查找对应IPv4 Intance路由表进行路由转发

赞(0)
未经允许不得转载:171主机测评 » MPLS Hub-Spoke场景以及OSPF双归防环
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址