MPLS VPN跨域问题
相比于域内的MPLS VPN,跨域场景下的VPN工作原理不变,但因为跨越了不同的AS,产生了以下问题
- AS之间不会运行LDP协议,因此AS之间无法建立外层隧道。
- PE之间没有运行IGP协议,缺省情况下无法建立BGP邻居关系,进而无法直接传递VPNv4路由。
针对以上问题可以有以下三大解决方案:
- ASBR之间交换IPv4路由,采用IPv4数据包转发数据。类似于ASBR与ASBR之间视为PE与CE的关系,通过建立VPN实例邻居的方式解决各自域内实例路由的交互问题。此类为OptionA方案。
- ASBR之间交换VPNv4路由,采用携带一层MPLS标签的方式转发数据包。指的是ASBR之间启用MPLS功能,并建立起MP-BGP邻居关系传递各自域内的VPN实例路由信息。此类为OptionB方案。
- PE之间交换VPNv4路由,采用携带多层MPLS标签的方式转发数据包。需要解决不同域之间PE的连通性问题,其次还有对应标签信息同步问题,才能实现最终的效果。此类为OptionC方案。
OptionA
解决思路
- OptionA方案中,要实现VPN实例跨域传递需要在ASBR设备上创建并建立相应VPN实例的BGP邻居关系。
- 如下图,AR2与AR7为VPN A实例,AR1与AR8为VPN B实例,需要跨域传递VPN实例路由就需要在ASBR上创建两个VPN实例绑定于子接口上,然后ASBR之间建立起VPN实例邻居交互各自的路由。
- 这种方式配置简单,ASBR之间也不需要额外运行其它,只需要创建对应的VPN实例。
优缺点
- 缺点:OptionA方案的缺点很明显,就是PE所接入的VPN实例越多,对于ASBR来说负担越重。
- 优点:配置简单且易于理解,适用于VPN业务不多的场景下。
案例
- 基于上面的拓扑图,在ASBR间应用OptionA方案实现VPN实例的跨域路由学习。
1、省略各设备IP地址配置
2、省略各CE设备(AR1、2、7、8)设备的BGP基础配置及测试路由引入
主要在PE及ASBR设备上配置
1.解决CE-PE之间的路由传递
- PE设备上创建VPN实例,绑定于连接CE的接口。
【AR3】
# 创建VPN实例
[AR3]ip vpn A
[AR3-vpn-instance-A]route-di 1:1
[AR3-vpn-instance-A-af-ipv4]vpn-target 1:1
[AR3-vpn-instance-A-af-ipv4]ip vpn B
[AR3-vpn-instance-B]route-di 2:2
[AR3-vpn-instance-B-af-ipv4]vpn-target 2:2
[AR3-vpn-instance-B-af-ipv4]int lo 0
[AR3-LoopBack0]ip add 3.3.3.3 32
# 绑定VPN实例
[AR3-LoopBack0]int g0/0/0
[AR3-GigabitEthernet0/0/0]ip bind vpn A
[AR3-GigabitEthernet0/0/0]ip add 10.1.23.3 24
[AR3-GigabitEthernet0/0/0]int g0/0/1
[AR3-GigabitEthernet0/0/1]ip bind vpn B
[AR3-GigabitEthernet0/0/1]ip add 10.1.13.3 24
[AR3-GigabitEthernet0/0/1]int g0/0/2
[AR3-GigabitEthernet0/0/2]ip add 10.1.34.3 24
【AR6】
# 创建VPN实例
[AR6]ip vpn A
[AR6-vpn-instance-A]
[AR6-vpn-instance-A]route-di 1:1
[AR6-vpn-instance-A-af-ipv4]vpn-target 1:1
[AR6-vpn-instance-A-af-ipv4]ip vpn B
[AR6-vpn-instance-B]route-di 2:2
[AR6-vpn-instance-B-af-ipv4]vpn-target 2:2
[AR6-vpn-instance-B-af-ipv4]int lo 0
[AR6-LoopBack0]ip add 6.6.6.6 32
# 绑定VPN实例
[AR6-LoopBack0]int g0/0/0
[AR6-GigabitEthernet0/0/0]ip bind vpn A
[AR6-GigabitEthernet0/0/0]ip add 10.1.67.6 24
[AR6-GigabitEthernet0/0/0]int g0/0/1
[AR6-GigabitEthernet0/0/1]ip bind vpn B
[AR6-GigabitEthernet0/0/1]ip add 10.1.68.6 24
[AR6-GigabitEthernet0/0/1]int g0/0/2
[AR6-GigabitEthernet0/0/2]ip add 10.1.56.6 24
- PE设备上建立与CE设备端的VPN实例邻居。
【AR3】
# 准备MP-BGP基础环境
[AR3-GigabitEthernet0/0/2]ospf 1 rou 3.3.3.3
[AR3-ospf-1]a 0
[AR3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[AR3-ospf-1-area-0.0.0.0]network 10.1.34.3 0.0.0.0
[AR3-ospf-1-area-0.0.0.0]mpls lsr 3.3.3.3
[AR3]mpls
[AR3-mpls]mpls ldp
[AR3-mpls-ldp]int g0/0/2
[AR3-GigabitEthernet0/0/2]mpls
[AR3-GigabitEthernet0/0/2]mpls ldp
# 配置MP-BGP及VPN实例邻居对接
[AR3-GigabitEthernet0/0/2]bgp 123
[AR3-bgp]peer 4.4.4.4 as 123
[AR3-bgp]peer 4.4.4.4 con lo 0
[AR3-bgp]ipv4 vpnv4
[AR3-bgp-af-vpnv4]peer 4.4.4.4 enable
[AR3-bgp-af-vpnv4]ipv4 vpn A
[AR3-bgp-A]peer 10.1.23.2 as 100
[AR3-bgp-A]ipv4 vpn B
[AR3-bgp-B]peer 10.1.13.1 as 200
#
【AR6】
# 准备MP-BGP基础环境
[AR6-GigabitEthernet0/0/2]ospf 1 rou 6.6.6.6
[AR6-ospf-1]a 0
[AR6-ospf-1-area-0.0.0.0]network 6.6.6.6 0.0.0.0
[AR6-ospf-1-area-0.0.0.0]network 10.1.56.6 0.0.0.0
[AR6-ospf-1-area-0.0.0.0]mpls lsr 6.6.6.6
[AR6]mpls
[AR6-mpls]mpls ldp
[AR6-mpls-ldp]int g0/0/2
[AR6-GigabitEthernet0/0/2]mpls
[AR6-GigabitEthernet0/0/2]mpls ldp
# 配置MP-BGP及VPN实例邻居对接
[AR6-GigabitEthernet0/0/2]bgp 124
[AR6-bgp]peer 5.5.5.5 as 124
[AR6-bgp]peer 5.5.5.5 con lo 0
[AR6-bgp]ipv4 vpnv4
[AR6-bgp-af-vpnv4]peer 5.5.5.5 enable
[AR6-bgp-af-vpnv4]ipv4 vpn A
[AR6-bgp-A]peer 10.1.67.7 as 101
[AR6-bgp-A]ipv4 vpn B
[AR6-bgp-B]peer 10.1.68.8 as 201
1.1 查看状态
<AR3>display bgp vpnv4 all peer
BGP local router ID : 3.3.3.3
Local AS number : 123
Total number of peers : 3 Peers in established state : 2
Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv
4.4.4.4 4 123 0 0 0 00:06:53 Idle 0
Peer of IPv4-family for vpn instance :
VPN-Instance A, Router ID 3.3.3.3:
10.1.23.2 4 100 10 9 0 00:07:01 Established 1
VPN-Instance B, Router ID 3.3.3.3:
10.1.13.1 4 200 9 8 0 00:06:58 Established 1
# 此时能学习到CE传来的路由
<AR3>display ip routing-table vpn-instance A
Destination/Mask Proto Pre Cost Flags NextHop Interface
192.168.20.0/24 EBGP 255 0 D 10.1.23.2 GigabitEthernet0/0/0
<AR3>display ip routing-table vpn-instance B
Destination/Mask Proto Pre Cost Flags NextHop Interface
192.168.10.0/24 EBGP 255 0 D 10.1.13.1 GigabitEthernet0/0/1
<AR6>display bgp vpnv4 all peer
BGP local router ID : 6.6.6.6
Local AS number : 124
Total number of peers : 3 Peers in established state : 2
Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv
5.5.5.5 4 124 0 0 0 00:05:49 Idle 0
Peer of IPv4-family for vpn instance :
VPN-Instance A, Router ID 6.6.6.6:
10.1.67.7 4 101 8 7 0 00:05:17 Established 1
VPN-Instance B, Router ID 6.6.6.6:
10.1.68.8 4 201 8 7 0 00:05:15 Established 1
# 此时能学习到CE传来的路由
<AR6>display ip routing-table vpn-instance A
Destination/Mask Proto Pre Cost Flags NextHop Interface
192.168.70.0/24 EBGP 255 0 D 10.1.67.7 GigabitEthernet0/0/0
<AR6>display ip routing-table vpn-instance B
Destination/Mask Proto Pre Cost Flags NextHop Interface
192.168.80.0/24 EBGP 255 0 D 10.1.68.8 GigabitEthernet0/0/1
2.解决PE至ASBR之间路由传递
- PE设备与ASBR设备之间可能会间隔多台P设备,此处省略P设备,但PE与ASBR设备之间还是存在IGP路由的。
【AR4】
# 创建VPN实例
[AR4]ip vpn A
[AR4-vpn-instance-A]route-di 1:1
[AR4-vpn-instance-A-af-ipv4]vpn-target 1:1
[AR4-vpn-instance-A-af-ipv4]ip vpn B
[AR4-vpn-instance-B]route-di 2:2
[AR4-vpn-instance-B-af-ipv4]vpn-target 2:2
[AR4-vpn-instance-B-af-ipv4]int lo 0
[AR4-LoopBack0]ip add 4.4.4.4 32
[AR4-LoopBack0]int g0/0/0
[AR4-GigabitEthernet0/0/0]ip add 10.1.34.4 24
# 绑定子接口VPN实例
[AR4-GigabitEthernet0/0/0]int g0/0/1.100
# ENSP中子接口必做两步骤
[AR4-GigabitEthernet0/0/1.100]dot1q termination vid 100
[AR4-GigabitEthernet0/0/1.100]arp broadcast enable
[AR4-GigabitEthernet0/0/1.100]ip bind vpn A
[AR4-GigabitEthernet0/0/1.100]ip add 10.1.45.4 24
[AR4-GigabitEthernet0/0/1.100]int g0/0/1.200
[AR4-GigabitEthernet0/0/1.200]dot1q termination vid 200
[AR4-GigabitEthernet0/0/1.200]arp broadcast enable
[AR4-GigabitEthernet0/0/1.200]ip bind vpn B
[AR4-GigabitEthernet0/0/1.200]ip add 10.1.45.4 24
# 准备MP-BGP基础环境
[AR4-GigabitEthernet0/0/1.200]ospf 1 rou 4.4.4.4
[AR4-ospf-1]
[AR4-ospf-1]a 0
[AR4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[AR4-ospf-1-area-0.0.0.0]network 10.1.34.4 0.0.0.0
[AR4-ospf-1-area-0.0.0.0]mpls lsr 4.4.4.4
[AR4]mpls
[AR4-mpls]mpls ldp
[AR4-mpls-ldp]int g0/0/0
[AR4-GigabitEthernet0/0/0]mpls
[AR4-GigabitEthernet0/0/0]mpls ldp
【AR5】
# 创建VPN实例
[AR5]ip vpn A
[AR5-vpn-instance-A]route-di 1:1
[AR5-vpn-instance-A-af-ipv4]vpn-target 1:1
[AR5-vpn-instance-A-af-ipv4]ip vpn B
[AR5-vpn-instance-B]route-di 2:2
[AR5-vpn-instance-B-af-ipv4]vpn-target 2:2
[AR5-vpn-instance-B-af-ipv4]int lo 0
[AR5-LoopBack0]ip add 5.5.5.5 32
[AR5-LoopBack0]int g0/0/0
[AR5-GigabitEthernet0/0/0]ip add 10.1.56.5 24
# 绑定子接口VPN实例
[AR5-GigabitEthernet0/0/0]int g0/0/1.100
# ENSP中子接口必做两步骤
[AR5-GigabitEthernet0/0/1.100]dot1q termination vid 100
[AR5-GigabitEthernet0/0/1.100]arp broadcast enable
[AR5-GigabitEthernet0/0/1.100]ip bind vpn A
[AR5-GigabitEthernet0/0/1.100]ip add 10.1.45.5 24
[AR5-GigabitEthernet0/0/1.100]int g0/0/1.200
[AR5-GigabitEthernet0/0/1.200]dot1q termination vid 200
[AR5-GigabitEthernet0/0/1.200]arp broadcast enable
[AR5-GigabitEthernet0/0/1.200]ip bind vpn B
[AR5-GigabitEthernet0/0/1.200]ip add 10.1.45.5 24
# 准备MP-BGP基础环境
[AR5-GigabitEthernet0/0/1.200]ospf 1 rou 5.5.5.5
[AR5-ospf-1]a 0
[AR5-ospf-1-area-0.0.0.0]network 5.5.5.5 0.0.0.0
[AR5-ospf-1-area-0.0.0.0]network 10.1.56.5 0.0.0.0
[AR5-ospf-1-area-0.0.0.0]mpls lsr 5.5.5.5
[AR5]mpls
[AR5-mpls]mpls ldp
[AR5-mpls-ldp]int g0/0/0
[AR5-GigabitEthernet0/0/0]mpls
[AR5-GigabitEthernet0/0/0]mpls ldp
- PE设备与ASBR设备通过IGP学习到的环回口建立MP-BGP邻居,交互各自的VPN实例路由。
【AR4】
[AR4-GigabitEthernet0/0/0]bgp 123
[AR4-bgp]peer 3.3.3.3 as 123
[AR4-bgp]peer 3.3.3.3 con lo 0
[AR4-bgp]ipv4 vpnv4
[AR4-bgp-af-vpnv4]peer 3.3.3.3 enable
[AR4-bgp-af-vpnv4]ipv4 vpn A
[AR4-bgp-A]peer 10.1.45.5 as 124
[AR4-bgp-A]ipv4 vpn B
[AR4-bgp-B]peer 10.1.45.5 as 124
【AR5】
[AR5-GigabitEthernet0/0/0]bgp 124
[AR5-bgp]peer 6.6.6.6 as 124
[AR5-bgp]peer 6.6.6.6 con lo 0
[AR5-bgp]ipv4 vpnv4
[AR5-bgp-af-vpnv4]peer 6.6.6.6 enable
[AR5-bgp-af-vpnv4]ipv4 vpn A
[AR5-bgp-A]peer 10.1.45.4 as 123
[AR5-bgp-A]ipv4 vpn B
[AR5-bgp-B]peer 10.1.45.4 as 123
2.1 查看状态
[AR4]dis bgp vpnv4 all peer
BGP local router ID : 4.4.4.4
Local AS number : 123
Total number of peers : 3 Peers in established state : 1
Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv
3.3.3.3 4 123 18 16 0 00:14:38 Established 2
# ASBR此时可以学习到PE传来的路由
[AR4]display ip routing-table vpn-instance A
Destination/Mask Proto Pre Cost Flags NextHop Interface
192.168.20.0/24 IBGP 255 0 RD 3.3.3.3 GigabitEthernet0/0/0
[AR4]display ip routing-table vpn-instance B
Destination/Mask Proto Pre Cost Flags NextHop Interface
192.168.10.0/24 IBGP 255 0 RD 3.3.3.3 GigabitEthernet0/0/0
<AR5>dis bgp vpnv4 all peer
BGP local router ID : 5.5.5.5
Local AS number : 123
Total number of peers : 3 Peers in established state : 1
Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv
6.6.6.6 4 123 13 11 0 00:09:24 Established 2
# ASBR此时可以学习到PE传来的路由
<AR5>display ip routing-table vpn-instance A
Destination/Mask Proto Pre Cost Flags NextHop Interface
192.168.70.0/24 IBGP 255 0 RD 6.6.6.6 GigabitEthernet0/0/0
<AR5>display ip routing-table vpn-instance B
Destination/Mask Proto Pre Cost Flags NextHop Interface
192.168.80.0/24 IBGP 255 0 RD 6.6.6.6 GigabitEthernet0/0/0
3.解决ASBR与ASBR之间的跨域路由传递
【AR4】
# 继续补充VPN实例邻居即可
[AR4]bgp 123
[AR4-bgp]ipv4 vpn A
[AR4-bgp-A]peer 10.1.45.5 as 124
[AR4-bgp-A]ipv4 vpn B
[AR4-bgp-B]peer 10.1.45.5 as 124
【AR5】
[AR5]bgp 124
[AR5-bgp]ipv4 vpn A
[AR5-bgp-A]peer 10.1.45.4 as 123
[AR5-bgp-A]ipv4 vpn B
[AR5-bgp-B]peer 10.1.45.4 as 123
3.1 查看状态
- 此时ASBR完成邻居建立:
[AR4]dis bgp vpnv4 all peer
BGP local router ID : 4.4.4.4
Local AS number : 123
Peer of IPv4-family for vpn instance :
VPN-Instance A, Router ID 4.4.4.4:
10.1.45.5 4 124 0 0 0 00:01:18 Established 0
VPN-Instance B, Router ID 4.4.4.4:
10.1.45.5 4 124 0 0 0 00:01:18 Established 0
<AR5>display bgp vpnv4 all peer
BGP local router ID : 5.5.5.5
Local AS number : 124
Peer of IPv4-family for vpn instance :
VPN-Instance A, Router ID 5.5.5.5:
10.1.45.4 4 123 0 0 0 00:01:18 Established 0
VPN-Instance B, Router ID 5.5.5.5:
10.1.45.4 4 123 0 0 0 00:01:18 Established 0
- 于各CE设备上成功学习到同VPN实例下的路由:
<AR2>dis bgp routing-table
BGP Local router ID is 10.1.23.2
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 192.168.20.0 0.0.0.0 0 0 i
*> 192.168.70.0 10.1.23.3 0 123 124 101i
<AR1>dis bgp routing-table
BGP Local router ID is 10.1.13.1
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 192.168.10.0 0.0.0.0 0 0 i
*> 192.168.80.0 10.1.13.3 0 123 124 201i
疑惑
1、ASBR之间可以只用一个VPN实例实现跨域路由交互嘛?
-
可以。
-
但该VPN实例将承载所有VPN实例的路由条目,且VPN实例之间的路由隔离效果将消失,VPNA与VPNB实例的部分路由将会混淆在一起。
[AR4]ip vpn C
[AR4-vpn-instance-C]route-distinguisher 3:3
[AR4-vpn-instance-C-af-ipv4]vpn-target 1:1
[AR4-vpn-instance-C-af-ipv4]vpn-target 2:2
[AR4-vpn-instance-C-af-ipv4]int g0/0/1
[AR4-GigabitEthernet0/0/1]ip bin vpn C
[AR4-GigabitEthernet0/0/1] ip address 10.1.45.4 24
[AR4-GigabitEthernet0/0/1]quit
[AR4]bgp 123
[AR4-bgp] ipv4-family vpn-instance C
[AR4-bgp-C] peer 10.1.45.5 as-number 124
[AR5]ip vpn C
[AR5-vpn-instance-C]route-distinguisher 3:3
[AR5-vpn-instance-C-af-ipv4]vpn-target 1:1
[AR5-vpn-instance-C-af-ipv4]vpn-target 2:2
[AR5-GigabitEthernet0/0/1]ip bin vpn C
[AR5-GigabitEthernet0/0/1]ip add 10.1.45.5 24
[AR4-GigabitEthernet0/0/1]quit
[AR4]bgp 124
[AR4-bgp] ipv4-family vpn-instance C
[AR4-bgp-C] peer 10.1.45.4 as-number 123
-
等待32秒定时器结束之后,建立邻居交互完路由。
-
于AR1上查看BGP路由,可以看到VPN B的路由条目(192.168.80.0)。
<AR2>dis bgp routing-table
BGP Local router ID is 10.1.23.2
Total Number of Routes: 3
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 192.168.20.0 0.0.0.0 0 0 i
*> 192.168.70.0 10.1.23.3 0 123 124 101i
*> 192.168.80.0 10.1.23.3 0 123 124 201i
1.1、什么原因造成部分路由混淆?
- 哪部分不会混淆在一起?
- 未跨域时的VPN实例路由条目,如下图中的AR2与AR1不会混淆,AR8与AR7不会混淆。
- 因为未跨域前AB实例的RT值并不匹配,A实例为1:1,B实例为2:2。
-
OptionA单实例解决跨域为啥会出现路由混淆?
- 来观察下ASBR向PE转发C实例路由的抓包信息:
-
为什么ASBR向PE转发的路由打上的是AB实例的RT值?
- 因为C实例要想同时接收AB实例的路由就需要IRT为AB实例的ERT值,即1:1与2:2。
- 也就是命令:
vpn-target 1:1 2:2 import-extcommunity
。 - 而我直接同时设置IRT与ERT一致的原因也主要是为了方便让大家理解。
- 如果ERT为3:3,即
vpn-target 3:3 export-extcommunity
,那么此时ASBR就会同PE转发ERT为3:3的VPNv4路由,此时就会因为AB实例上并没有配置IRT 3:3而使得AB实例无法接收到C实例路由。 - 但你仔细一想就会发现,哪怕修改了ERT,对于C实例来说还是无法完美的标注出跨了域的AB实例路由。
-
所以,在通过OptionA方案实现跨域MPLS VPN时,存在N个VPN实例时,ASBR就需要创建N个VPN实例和子接口与之对应。