route-policy change_mpls permit node 5
apply mpls-label
bgp 100
peer PE1 label-route-capability
peer PE1 route-policy change_mpls export
# 与PE2建立MP-BGP邻居
peer PE2 as 200
peer PE2 con lo 0
peer PE2 ebgp-max-hop 20
ipv4 v4
peer PE2 enable
3、解决VPN实例路由在ASBR之间传递问题:由于ASBR之间互相建立的是EBGP邻居,无法转发实例路由(VPNv4),故需要ASBR设备向对端ASBR设备传递路由时也打上标签,解决路由传递问题。
route-policy mpls permit node 5
apply mpls-label
bgp 100
peer ASBR label-route-capability
peer ASBR route-policy mpls export
# 注意需要在ASBR互联链路之间开启MPLS功能
int g0/0/1
mpls
4、汇总配置,由于对端ASBR2向ASBR1传递路由时是打上标签的,故需要修改一下第一条路由策略信息change_mpls:
# 仅对对端ASBR传递来的PE设备手动打上标签
route-policy change_mpls permit node 5
if-match mpls-label
apply mpls-label
bgp 100
peer PE1 label-route-capability
peer PE1 route-policy change_mpls export
ASBR1
[ASBR1]int g0/0/1
[ASBR1-GigabitEthernet0/0/1]ip add 10.1.12.1 30
[ASBR1-GigabitEthernet0/0/1]bgp 100
[ASBR1-bgp]peer 10.1.12.2 as 200
[ASBR1-bgp]network 1.1.1.1 32
[PE1-bgp]dis bgp routing-table
BGP Local router ID is 10.1.111.5
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 1.1.1.1/32 3.3.3.3 2 100 0 i
*>i 11.11.11.11/32 3.3.3.3 2 100 0 200i
[PE2-bgp]dis bgp routing-table
BGP Local router ID is 10.1.211.5
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 1.1.1.1/32 33.33.33.33 2 100 0 100i
*>i 11.11.11.11/32 33.33.33.33 2 100 0 i
PE1
[PE1] bgp 100
[PE1-bgp] peer 11.11.11.11 as-number 200
[PE1-bgp] peer 11.11.11.11 connect-interface LoopBack0
# 缺省EBGP建立只有1跳
[PE1-bgp] peer 11.11.11.11 ebgp-max-hop 20
[PE1-bgp] ipv4-family v4
[PE1-bgp-af-v4] peer 11.11.11.11 enable
ASBR1
# 用于绑定在PE方向
[ASBR1]route-policy change_mpls permit node 5
[ASBR1-route-policy]if-match mpls-label
[ASBR1-route-policy]apply mpls-label
[ASBR1-route-policy]quit
# 用于绑定在对端ASBR方向
[ASBR1]route-policy mpls permit node 5
[ASBR1-route-policy]apply mpls-label
[ASBR1-route-policy]quit
# 绑定PE方向的策略,及开启标签路由能力
[ASBR1]bgp 100
[ASBR1-bgp]peer 1.1.1.1 label-route-capability
[ASBR1-bgp]peer 1.1.1.1 route-policy change_mpls export
# 绑定对端ASBR方向的策略,及开启标签路由能力
[ASBR1-bgp]peer 10.1.12.2 label-route-capability
[ASBR1-bgp]peer 10.1.12.2 route-policy mpls export
# 以及ASBR接口需要开启MPLS功能
[ASBR1-bgp]int g0/0/1
[ASBR1-GigabitEthernet0/0/1]mpls
PE1
# PE1方向只需要开启发送标签路由能力
[PE1]bgp 100
[PE1-bgp]peer 3.3.3.3 label-route-capability
<PE1>display bgp peer
BGP local router ID : 10.1.111.5
Local AS number : 100
Peer V AS MsgRcvd MsgSent OutQ Up/Down StatePrefRcv
3.3.3.3 4 100 7 6 0 00:04:04 Established 1
11.11.11.11 4 200 4 4 0 00:00:52 Established 0
<PE2>display bgp peer
BGP local router ID : 10.1.211.5
Local AS number : 200
Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv
1.1.1.1 4 100 5 5 0 00:01:37 Established 0
33.33.33.33 4 200 4 3 0 00:01:58 Established 1
<PE1>dis mpls lsp
-------------------------------------------------------------------------------
LSP Information: BGP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
11.11.11.11/32 NULL/1028 -/-
192.168.10.0/24 1026/NULL -/- A
-------------------------------------------------------------------------------
LSP Information: LDP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
1.1.1.1/32 3/NULL -/-
2.2.2.2/32 NULL/3 -/GE0/0/1
2.2.2.2/32 1024/3 -/GE0/0/1
3.3.3.3/32 NULL/1025 -/GE0/0/1
3.3.3.3/32 1025/1025 -/GE0/0/1
<ASBR1>dis mpls lsp
-------------------------------------------------------------------------------
LSP Information: BGP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
1.1.1.1/32 1027/NULL -/-
11.11.11.11/32 1028/1029 -/-
11.11.11.11/32 NULL/1029 -/-
-------------------------------------------------------------------------------
LSP Information: LDP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
1.1.1.1/32 NULL/1024 -/GE0/0/0
1.1.1.1/32 1024/1024 -/GE0/0/0
2.2.2.2/32 NULL/3 -/GE0/0/0
2.2.2.2/32 1025/3 -/GE0/0/0
3.3.3.3/32 3/NULL -/-
<ASBR2>dis mpls lsp
-------------------------------------------------------------------------------
LSP Information: BGP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
11.11.11.11/32 1029/NULL -/-
1.1.1.1/32 NULL/1027 -/-
1.1.1.1/32 1030/1027 -/-
-------------------------------------------------------------------------------
LSP Information: LDP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
33.33.33.33/32 3/NULL -/-
22.22.22.22/32 NULL/3 -/GE0/0/0
22.22.22.22/32 1024/3 -/GE0/0/0
11.11.11.11/32 NULL/1025 -/GE0/0/0
11.11.11.11/32 1025/1025 -/GE0/0/0
<PE2>dis mpls lsp
-------------------------------------------------------------------------------
LSP Information: BGP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
1.1.1.1/32 NULL/1030 -/-
192.168.20.0/24 1026/NULL -/- A
-------------------------------------------------------------------------------
LSP Information: LDP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
22.22.22.22/32 NULL/3 -/GE0/0/1
22.22.22.22/32 1024/3 -/GE0/0/1
33.33.33.33/32 NULL/1024 -/GE0/0/1
33.33.33.33/32 1025/1024 -/GE0/0/1
11.11.11.11/32 3/NULL -/-
<CE1>ping -a 192.168.10.254 192.168.20.254
PING 192.168.20.254: 56 data bytes, press CTRL_C to break
Reply from 192.168.20.254: bytes=56 Sequence=1 ttl=249 time=210 ms
Reply from 192.168.20.254: bytes=56 Sequence=2 ttl=249 time=60 ms
Reply from 192.168.20.254: bytes=56 Sequence=3 ttl=249 time=50 ms
Reply from 192.168.20.254: bytes=56 Sequence=4 ttl=249 time=60 ms
Reply from 192.168.20.254: bytes=56 Sequence=5 ttl=249 time=60 ms
<CE2>ping -a 192.168.20.254 192.168.10.254
PING 192.168.10.254: 56 data bytes, press CTRL_C to break
Reply from 192.168.10.254: bytes=56 Sequence=1 ttl=249 time=90 ms
Reply from 192.168.10.254: bytes=56 Sequence=2 ttl=249 time=60 ms
Reply from 192.168.10.254: bytes=56 Sequence=3 ttl=249 time=70 ms
Reply from 192.168.10.254: bytes=56 Sequence=4 ttl=249 time=80 ms
Reply from 192.168.10.254: bytes=56 Sequence=5 ttl=249 time=90 ms
[ASBR1]dis bgp routing-table
BGP Local router ID is 10.1.111.10
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 1.1.1.1/32 0.0.0.0 2 0 i
*> 11.11.11.11/32 10.1.12.2 2 0 200i
<PE1>dis bgp routing-table
BGP Local router ID is 10.1.111.5
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 1.1.1.1/32 3.3.3.3 2 100 0 i
# 与PE1建立IBGP邻居并绑定策略
# 与对端ASBR建立EBGP
# 经过实验证明,label-route-capability并不影响目前实验。
bgp 100
peer 1.1.1.1 as-number 100
peer 1.1.1.1 connect-interface LoopBack0
peer 10.1.12.2 as-number 200
#
ipv4-family unicast
undo synchronization
network 1.1.1.1 255.255.255.255
peer 1.1.1.1 enable
peer 1.1.1.1 route-policy mpls export
peer 1.1.1.1 next-hop-local
peer 1.1.1.1 label-route-capability
peer 10.1.12.2 enable
peer 10.1.12.2 label-route-capability
#
route-policy mpls permit node 5
apply mpls-label
#
bgp 100
peer 1.1.1.1 as-number 100
peer 1.1.1.1 connect-interface LoopBack0
peer 10.1.12.2 as-number 200
#
ipv4-family unicast
undo synchronization
network 1.1.1.1 255.255.255.255
peer 1.1.1.1 enable
peer 1.1.1.1 next-hop-local
peer 1.1.1.1 label-route-capability
peer 10.1.12.2 enable
peer 10.1.12.2 route-policy mpls export
peer 10.1.12.2 label-route-capability
#
[ASBR1-bgp]dis mpls lsp
-------------------------------------------------------------------------------
LSP Information: BGP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
1.1.1.1/32 1026/NULL -/-
11.11.11.11/32 NULL/1026 -/-
-------------------------------------------------------------------------------
LSP Information: LDP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
1.1.1.1/32 NULL/1024 -/GE0/0/0
1.1.1.1/32 1024/1024 -/GE0/0/0
2.2.2.2/32 NULL/3 -/GE0/0/0
2.2.2.2/32 1025/3 -/GE0/0/0
3.3.3.3/32 3/NULL -/-
[ASBR2-bgp]dis mpls lsp
-------------------------------------------------------------------------------
LSP Information: BGP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
1.1.1.1/32 NULL/1026 -/-
11.11.11.11/32 1026/NULL -/-
-------------------------------------------------------------------------------
LSP Information: LDP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
11.11.11.11/32 NULL/1024 -/GE0/0/0
11.11.11.11/32 1024/1024 -/GE0/0/0
22.22.22.22/32 NULL/3 -/GE0/0/0
22.22.22.22/32 1025/3 -/GE0/0/0
33.33.33.33/32 3/NULL -/-
<PE1>dis bgp routing-table
BGP Local router ID is 10.1.111.5
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 1.1.1.1/32 3.3.3.3 2 100 0 i
*>i 11.11.11.11/32 3.3.3.3 2 100 0 200i
<PE2>dis bgp routing-table
BGP Local router ID is 10.1.211.5
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 1.1.1.1/32 33.33.33.33 2 100 0 100i
*>i 11.11.11.11/32 33.33.33.33 2 100 0 i
<PE1>dis fib
--------------------------------------------------------------------------------
FIB Table:
Destination/Mask Nexthop Flag TimeStamp Interface TunnelID
11.11.11.11/32 10.1.111.6 DGHU t[217] GE0/0/1 0x0
3.3.3.3/32 10.1.111.6 DGHU t[75] GE0/0/1 0x3
2.2.2.2/32 10.1.111.6 DGHU t[70] GE0/0/1 0x1
# 可以明显看到PE2环回口11.11.11.11的TunnelID=0x0并不走标签转发。
# 所以造成了PE1访问P2时,经过P设备时因为找不到PE2路由而出现丢包。
# 此处附上相应MPLS LSP信息
<PE1>dis mpls lsp
-------------------------------------------------------------------------------
LSP Information: BGP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
11.11.11.11/32 NULL/1029 -/-
192.168.10.0/24 1026/NULL -/- A
-------------------------------------------------------------------------------
LSP Information: LDP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
2.2.2.2/32 NULL/3 -/GE0/0/1
2.2.2.2/32 1024/3 -/GE0/0/1
3.3.3.3/32 NULL/1024 -/GE0/0/1
3.3.3.3/32 1025/1024 -/GE0/0/1
1.1.1.1/32 3/NULL -/-
# 此处可以看到相应的私网标签
<PE1>dis bgp v4 all routing-table label
BGP Local router ID is 10.1.111.5
Route Distinguisher: 1:1
Network NextHop In/Out Label
*> 192.168.10.0 10.1.111.1 1026/NULL
*> 192.168.20.0 11.11.11.11 NULL/1026
# ASBR1相应的MPLS LSP标签信息
# PE1发来1029标签之后,替换为1028继续转发给ASBR2
<ASBR1>dis mpls lsp
-------------------------------------------------------------------------------
LSP Information: BGP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
1.1.1.1/32 1028/NULL -/-
11.11.11.11/32 1029/1028 -/-
11.11.11.11/32 NULL/1028 -/-
# ASBR2相应的MPLS LSP标签信息
<ASBR2>dis mpls lsp
-------------------------------------------------------------------------------
LSP Information: BGP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
11.11.11.11/32 1028/NULL -/-
1.1.1.1/32 NULL/1028 -/-
1.1.1.1/32 1029/1028 -/-
-------------------------------------------------------------------------------
LSP Information: LDP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
33.33.33.33/32 3/NULL -/-
22.22.22.22/32 NULL/3 -/GE0/0/0
22.22.22.22/32 1025/3 -/GE0/0/0
11.11.11.11/32 NULL/1025 -/GE0/0/0
11.11.11.11/32 1026/1025 -/GE0/0/0
<PE2>dis mpls lsp
-------------------------------------------------------------------------------
LSP Information: BGP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
1.1.1.1/32 NULL/1029 -/-
192.168.20.0/24 1026/NULL -/- A
-------------------------------------------------------------------------------
LSP Information: LDP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
22.22.22.22/32 NULL/3 -/GE0/0/1
22.22.22.22/32 1024/3 -/GE0/0/1
33.33.33.33/32 NULL/1024 -/GE0/0/1
33.33.33.33/32 1025/1024 -/GE0/0/1
11.11.11.11/32 3/NULL -/-
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- vipyiyao.com 版权所有 湘ICP备2023022495号-8
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务