目录
一、概述
二、组网需求
三、实验拓扑
四、实验目的
五、实验编址表
六、实验步骤
1.基本配置
2.配置运营商网络的OSPF路由协议
3.配置运营商网络的MPLS协议与LDP
4.配置PE与ASBR设备间的MP-BGP
5.在PE、ASBR上创建VPN实例并与接口绑定
6.配置PE与CE的连通性
7.配置ASBR之间的连通,建立EBGP对等体关系
8.查看路由的传递、验证PCA与PCB的连通性
9.实现PCA、PCB内网用户的上网功能
七、结束语
一、概述
BGP/MPLS VPN有时也简称为MPLS L3 VPN,它是MPLS最为广泛的应用之一。BGP/MPLS VPN主要部署在运营商网络中。
二、组网需求
三、实验拓扑
四、实验目的
五、实验编址表
设备 | 接口 | IP地址 | 子网掩码 | 默认网关 |
---|---|---|---|---|
CE1 | GE0/0/0 | 100.0.10.2 | 255.255.255.0 | N/A |
GE0/0/1 | 192.168.10.254 | 255.255.255.0 | N/A | |
Loopback 0 | 7.7.7.7 | 255.255.255.255 | N/A | |
PE1 | GE0/0/0 | 100.0.10.1 | 255.255.255.0 | N/A |
GE0/0/1 | 101.0.10.1 | 255.255.255.0 | N/A | |
Loopback 0 | 1.1.1.1 | 255.255.255.255 | N/A | |
P1 | GE0/0/0 | 100.0.20.2 | 255.255.255.0 | N/A |
GE0/0/1 | 101.0.10.2 | 255.255.255.0 | N/A | |
Loopback 0 | 2.2.2.2 | 255.255.255.255 | N/A | |
ASBR1 | GE0/0/0 | 100.0.20.3 | 255.255.255.0 | N/A |
GE0/0/1 | 192.1.1.1 | 255.255.255.252 | N/A | |
Loopback 0 | 3.3.3.3 | 255.255.255.255 | N/A | |
CE2 | GE0/0/0 | 200.0.10.2 | 255.255.255.0 | N/A |
GE0/0/1 | 192.168.20.254 | 255.255.255.0 | N/A | |
Loopback 0 | 8.8.8.8 | 255.255.255.255 | N/A | |
PE2 | GE0/0/0 | 200.0.10.1 | 255.255.255.0 | N/A |
GE0/0/1 | 201.0.10.1 | 255.255.255.0 | N/A | |
Loopback 0 | 6.6.6.6 | 255.255.255.255 | N/A | |
P2 | GE0/0/0 | 201.0.20.5 | 255.255.255.0 | N/A |
GE0/0/1 | 201.0.10.5 | 255.255.255.0 | N/A | |
Loopback 0 | 5.5.5.5 | 255.255.255.255 | N/A | |
ASBR2 | GE0/0/0 | 100.0.20.3 | 255.255.255.0 | N/A |
GE0/0/1 | 192.1.1.2 | 255.255.255.252 | N/A | |
Loopback 0 | 4.4.4.4 | 255.255.255.255 | N/A | |
PCA(PC1) | ETH 0/0/1 | 192.168.10.1 | 255.255.255.0 | 192.168.10.254 |
PCB(PC2) | ETH 0/0/1 | 192.168.20.1 | 255.255.255.0 | 192.168.20.254 |
六、实验步骤
1.基本配置
根据图1和表1 进行相应的基本配置,并检查各个设备之间的直连网络连通性。此过程配置略。
2.配置运营商网络的OSPF路由协议
在AS100内配置OSPF协议作为IGP,各个路由器均属于区域0,且使用Loopback 0接口IP作为Router-ID。
<PE1>system-view
Enter system view, return user view with Ctrl+Z.
[PE1]ospf 2 router-id 1.1.1.1 //创建OSPF进程
[PE1-ospf-2]area 0.0.0.0
//在各个接口上使能OPPF 2,宣告接口到Area 0 区域
[PE1]interface GigabitEthernet0/0/1
[PE1-GigabitEthernet0/0/1]ospf enable 2 area 0.0.0.0
[PE1]interface LoopBack0
[PE1-LoopBack0]ospf enable 2 area 0.0.0.0
[P1]ospf 2 router-id 2.2.2.2 //创建OSPF进程
[P1-ospf-2]area 0.0.0.0
//在各个接口上使能OPPF 2,宣告接口到Area 0 区域
[P1]interface GigabitEthernet0/0/0
[P1-GigabitEthernet0/0/1]ospf enable 2 area 0.0.0.0
[P1]interface GigabitEthernet0/0/1
[P1-GigabitEthernet0/0/1]ospf enable 2 area 0.0.0.0
[P1]interface LoopBack0
[P1-LoopBack0]ospf enable 2 area 0.0.0.0
[ASBR1]ospf 2 router-id 2.2.2.2 //创建OSPF进程
[ASBR1-ospf-2]area 0.0.0.0
//在各个接口上使能OPPF 2,宣告接口到Area 0 区域
[ASBR1]interface GigabitEthernet0/0/0
[ASBR1-GigabitEthernet0/0/1]ospf enable 2 area 0.0.0.0
[ASBR1]interface LoopBack0
[ASBR1-LoopBack0]ospf enable 2 area 0.0.0.0
<PE2>system-view
Enter system view, return user view with Ctrl+Z.
[PE2]ospf 2 router-id 6.6.6.6 //创建OSPF进程
[PE2-ospf-2]area 0.0.0.0
//在各个接口上使能OPPF 2,宣告接口到Area 0 区域
[PE2]interface GigabitEthernet0/0/0
[PE2-GigabitEthernet0/0/1]ospf enable 2 area 0.0.0.0
[PE2]interface GigabitEthernet0/0/1
[PE2-GigabitEthernet0/0/1]ospf enable 2 area 0.0.0.0
[PE2]interface LoopBack0
[PE2-LoopBack0]ospf enable 2 area 0.0.0.0
[P2]ospf 2 router-id 5.5.5.5 //创建OSPF进程
[P2-ospf-2]area 0.0.0.0
//在各个接口上使能OPPF 2,宣告接口到Area 0 区域
[P2]interface GigabitEthernet0/0/0
[P2-GigabitEthernet0/0/1]ospf enable 2 area 0.0.0.0
[P2]interface GigabitEthernet0/0/1
[P2-GigabitEthernet0/0/1]ospf enable 2 area 0.0.0.0
[P2]interface LoopBack0
[P2-LoopBack0]ospf enable 2 area 0.0.0.0
[ASBR1]ospf 2 router-id 4.4.4.4 //创建OSPF进程
[ASBR1-ospf-2]area 0.0.0.0
//在各个接口上使能OPPF 2,宣告接口到Area 0 区域
[ASBR2]interface GigabitEthernet0/0/0
[ASBR2-GigabitEthernet0/0/1]ospf enable 2 area 0.0.0.0
[ASBR2]interface LoopBack0
[ASBR2-LoopBack0]ospf enable 2 area 0.0.0.0
配置完成后,PE1、P1、ASBR1等设备上查看OSPF邻居建立情况。
<PE1>display ospf peer brief
OSPF Process 2 with Router ID 1.1.1.1
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet0/0/1 2.2.2.2 Full
----------------------------------------------------------------------------
<P1>display ospf peer brief
OSPF Process 2 with Router ID 2.2.2.2
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet0/0/0 3.3.3.3 Full
0.0.0.0 GigabitEthernet0/0/1 1.1.1.1 Full
----------------------------------------------------------------------------
<ASBR1>dis ospf peer brief
OSPF Process 2 with Router ID 3.3.3.3
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet0/0/0 2.2.2.2 Full
----------------------------------------------------------------------------
可以看到ISPA中的各个设备已经建立起OSPF互联,邻居关系已经建立。ISPB中情况类似,自行验证即可。
3.配置运营商网络的MPLS协议与LDP
在AS 100、AS 200内分别配置MPLS协议与LDP,各个路由器使用Loopback 0 接口地址作为LSR-ID。
---------------------------------------ISPA-------------------------------------------
//使能PE1全局MPLS协议及LDP协议
[PE1]mpls lsr-id 1.1.1.1
[PE1]mpls
[PE1-mpls]mpls ldp
[PE1-mpls]quit
//在接口GigabitEthernet 0/0/1中使能MPLS协议及LDP协议
[PE1]interface GigabitEthernet 0/0/1
[PE1-GigabitEthernet0/0/1]mpls
[PE1-GigabitEthernet0/0/1]mpls ldp
[PE1-GigabitEthernet0/0/1]quit
//使能P1全局MPLS协议及LDP协议
[P1]mpls lsr-id 2.2.2.2
[P1]mpls
[P1-mpls]mpls ldp
[P1-mpls]quit
//在接口GigabitEthernet 0/0/0和GigabitEthernet 0/0/1中使能MPLS协议及LDP协议
[P1]interface GigabitEthernet 0/0/0
[P1-GigabitEthernet0/0/0]mpls
[P1-GigabitEthernet0/0/0]mpls ldp
[P1-GigabitEthernet0/0/0]quit
[P1]interface GigabitEthernet 0/0/1
[P1-GigabitEthernet0/0/1]mpls
[P1-GigabitEthernet0/0/1]mpls ldp
[P1-GigabitEthernet0/0/1]quit
//使能ASBR1全局MPLS协议及LDP协议
[ASBR1]mpls lsr-id 3.3.3.3
[ASBR1]mpls
[ASBR1-mpls]mpls ldp
[ASBR1-mpls]quit
//在接口GigabitEthernet 0/0/0中使能MPLS协议及LDP协议
[ASBR1]interface GigabitEthernet 0/0/0
[ASBR1-GigabitEthernet0/0/0]mpls
[ASBR1-GigabitEthernet0/0/0]mpls ldp
[ASBR1-GigabitEthernet0/0/0]quit
---------------------------------------ISPB-------------------------------------------
//使能PE2全局MPLS协议及LDP协议
[PE2]mpls lsr-id 6.6.6.6
[PE2]mpls
[PE2-mpls]mpls ldp
[PE2-mpls]quit
//在接口GigabitEthernet 0/0/1中使能MPLS协议及LDP协议
[PE2]interface GigabitEthernet 0/0/1
[PE2-GigabitEthernet0/0/1]mpls
[PE2-GigabitEthernet0/0/1]mpls ldp
[PE2-GigabitEthernet0/0/1]quit
//使能P2全局MPLS协议及LDP协议
[P2]mpls lsr-id 5.5.5.5
[P2]mpls
[P2-mpls]mpls ldp
[P2-mpls]quit
//在接口GigabitEthernet 0/0/0和GigabitEthernet 0/0/1中使能MPLS协议及LDP协议
[P2]interface GigabitEthernet 0/0/0
[P2-GigabitEthernet0/0/0]mpls
[P2-GigabitEthernet0/0/0]mpls ldp
[P2-GigabitEthernet0/0/0]quit
[P2]interface GigabitEthernet 0/0/1
[P2-GigabitEthernet0/0/1]mpls
[P2-GigabitEthernet0/0/1]mpls ldp
[P2-GigabitEthernet0/0/1]quit
//使能ASBR2全局MPLS协议及LDP协议
[ASBR2]mpls lsr-id 4.4.4.4
[ASBR2]mpls
[ASBR2-mpls]mpls ldp
[ASBR2-mpls]quit
//在接口GigabitEthernet 0/0/0中使能MPLS协议及LDP协议
[ASBR2]interface GigabitEthernet 0/0/0
[ASBR2-GigabitEthernet0/0/0]mpls
[ASBR2-GigabitEthernet0/0/0]mpls ldp
[ASBR2-GigabitEthernet0/0/0]quit
配置完成后在PE1、P1、ASBR1等设备上查看LDP会话建立情况。
<PE1>display mpls ldp session
LDP Session(s) in Public Network
Codes: LAM(Label Advertisement Mode), SsnAge Unit(DDDD:HH:MM)
A '*' before a session means the session is being deleted.
------------------------------------------------------------------------------
PeerID Status LAM SsnRole SsnAge KASent/Rcv
------------------------------------------------------------------------------
2.2.2.2:0 Operational DU Passive 0000:01:00 241/241
------------------------------------------------------------------------------
TOTAL: 1 session(s) Found.
<P1>display mpls ldp session
LDP Session(s) in Public Network
Codes: LAM(Label Advertisement Mode), SsnAge Unit(DDDD:HH:MM)
A '*' before a session means the session is being deleted.
------------------------------------------------------------------------------
PeerID Status LAM SsnRole SsnAge KASent/Rcv
------------------------------------------------------------------------------
1.1.1.1:0 Operational DU Active 0000:01:01 244/244
3.3.3.3:0 Operational DU Passive 0000:01:01 245/245
------------------------------------------------------------------------------
TOTAL: 2 session(s) Found.
<ASBR1>display mpls ldp session
LDP Session(s) in Public Network
Codes: LAM(Label Advertisement Mode), SsnAge Unit(DDDD:HH:MM)
A '*' before a session means the session is being deleted.
------------------------------------------------------------------------------
PeerID Status LAM SsnRole SsnAge KASent/Rcv
------------------------------------------------------------------------------
2.2.2.2:0 Operational DU Active 0000:01:01 246/246
------------------------------------------------------------------------------
TOTAL: 1 session(s) Found.
可以看到,LDP会话状态为Operational,会话建立成功。ISP B内的设备情况类似,可自行验证。
在PE1、P1、ASBR1等设备上查看LSP信息。
<PE1>display mpls lsp
-------------------------------------------------------------------------------
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 -/-
<P1>display mpls lsp
-------------------------------------------------------------------------------
LSP Information: LDP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
3.3.3.3/32 NULL/3 -/GE0/0/0
3.3.3.3/32 1024/3 -/GE0/0/0
2.2.2.2/32 3/NULL -/-
1.1.1.1/32 NULL/3 -/GE0/0/1
1.1.1.1/32 1025/3 -/GE0/0/1
<ASBR1>display mpls lsp
-------------------------------------------------------------------------------
LSP Information: LDP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
3.3.3.3/32 3/NULL -/-
2.2.2.2/32 NULL/3 -/GE0/0/0
2.2.2.2/32 1024/3 -/GE0/0/0
1.1.1.1/32 NULL/1025 -/GE0/0/0
1.1.1.1/32 1025/1025 -/GE0/0/0
可以看到,MPLS网络已经为PE1、P1、ASBR1的Loopback接口路由建立了相应LSP。ISP B内的设备情况类似,可自行验证。
4.配置PE与ASBR设备间的MP-BGP
首先,在PE与ASBR设备间建立IBGP邻居关系。
[PE1]bgp 100
[PE1-bgp]router-id 1.1.1.1
[PE1-bgp]peer 3.3.3.3 as-number 100
[PE1-bgp]peer 3.3.3.3 connect-interface LoopBack0
[PE1-bgp]peer 3.3.3.3 next-hop-local
然后,使用ipv4-family vpnv4命令进入VPNv4视图。
//进入VPNv4视图
[PE1-bgp]ipv4-family vpnv4
//在VPNv4视图下启用与对等体交换VPNv4路由信息的能力。
[PE1-bgp-af-vpnv4]peer 3.3.3.3 enable
//允许与对等体交换路由信息时携带BGP团体属性。
[PE1-bgp-af-vpnv4]peer 3.3.3.3 advertise-community
在ASBR1上完成同样的配置。
[ASBR1]bgp 100
[ASBR1-bgp]router-id 3.3.3.3
[ASBR1-bgp]peer 1.1.1.1 as-number 100
[ASBR1-bgp]peer 1.1.1.1 connect-interface LoopBack0
[ASBR1-bgp]peer 1.1.1.1 next-hop-local
[ASBR1-bgp]ipv4-family vpnv4
[ASBR1-bgp-af-vpnv4]peer 1.1.1.1 enable
[ASBR1-bgp-af-vpnv4]peer 1.1.1.1 advertise-community
配置完成后,在PE、ASBR上查看BGP邻居关系。
<PE1>display bgp peer
BGP local router ID : 1.1.1.1
Local AS number : 100
Total number of peers : 1 Peers in established state : 1
Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv
3.3.3.3 4 100 86 87 0 01:20:29 Established 1
<ASBR1>display bgp peer
BGP local router ID : 3.3.3.3
Local AS number : 100
Total number of peers : 1 Peers in established state : 1
Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv
1.1.1.1 4 100 88 88 0 01:22:44 Established 0
可以看到,PE1与ASBR之间的BGP邻居状态为Established ,表明BGP邻居关系已经成功建立。 同样的,ISP B中的PE2与ASBR2的MP-BGP 关系以同样的方式建立,不再赘述,以下为相应的命令。
[PE2]bgp 200
[PE2-bgp]router-id 6.6.6.6
[PE2-bgp]peer 4.4.4.4 as-number 200
[PE2-bgp]peer 4.4.4.4 connect-interface LoopBack0
[PE2-bgp]peer 4.4.4.4 next-hop-local
[PE2-bgp]ipv4-family vpnv4
[PE2-bgp-af-vpnv4]peer 4.4.4.4 enable
[PE2-bgp-af-vpnv4]peer 4.4.4.4 advertise-community
[ASBR2]bgp 200
[ASBR2-bgp]router-id 4.4.4.4
[ASBR2-bgp]peer 6.6.6.6 as-number 100
[ASBR2-bgp]peer 6.6.6.6 connect-interface LoopBack0
[ASBR2-bgp]peer 6.6.6.6 next-hop-local
[ASBR2-bgp]ipv4-family vpnv4
[ASBR2-bgp-af-vpnv4]peer 6.6.6.6 enable
[ASBR2-bgp-af-vpnv4]peer 6.6.6.6 advertise-community
5.在PE、ASBR上创建VPN实例并与接口绑定
首先,分别在PE、ASBR设备上建立VPN实例,在VPN实例中启用IPv4地址族,然后进入IPv4地址族视图中配置RD、RT等;最后配置Import、Export方向的VPN-Target团体属性。为了方便起见,分别定义以下VPN实例名、 RD、RT:
设备 | VPN实例名 | RD | RT both |
PE1 | VPNA | 100:1 | 100:1 |
ASBR1 |
VPNA | 101:1 | 100:1 |
PE2 | VPNA | 200:1 | 100:1 |
ASBR2 |
VPNA | 201:1 | 100:1 |
PE1 上创建名为VPNA的VPN实例,RD为100:1,VPN-Target为100:1,绑定接口为GigabitEthernet0/0/0。
<PE1>system-view
//创建名为VPNA的VPN实例
[PE1]ip vpn-instance VPNA
//使用ipv4-family命令启用VPNA 实例的IPv4地址族
[PE1-vpn-instance-VPNA]ipv4-family
//在IPv4地址族视图下使用route-distinguisher 100:1命令配置RD为100:1
[PE1-vpn-instance-VPNA-af-ipv4]route-distinguisher 100:1
//使用vpn-target both命令Import、Export方向的VPN-Target团体属性
[PE1-vpn-instance-VPNA-af-ipv4]vpn-target 100:1 export-extcommunity
[PE1-vpn-instance-VPNA-af-ipv4]vpn-target 100:1 import-extcommunity
//进入PE1GigabitEthernet0/0/0接口视图下,使用ip binding vpn-instance VPNA命令将
GigabitEthernet0/0/0接口与VPN实例VPNA进行绑定。
[PE1]interface GigabitEthernet0/0/0
[PE1-GigabitEthernet0/0/0]ip binding vpn-instance VPNA
Info: All IPv4 related configurations on this interface are removed!
Info: All IPv6 related configurations on this interface are removed!
//注意,绑定后接口的IP地址信息将被删除,需要重新配置。
[PE1-GigabitEthernet0/0/0]ip address 100.0.10.1 255.255.255.0
ASBR 上创建名为VPNA的VPN实例,RD为101:1,VPN-Target为100:1,绑定接口为GigabitEthernet0/0/1。
<ASBR1>system-view
[ASBR1]ip vpn-instance VPNA
[ASBR1-vpn-instance-VPNA]ipv4-family
[ASBR1-vpn-instance-VPNA-af-ipv4]route-distinguisher 101:1
[ASBR1-vpn-instance-VPNA-af-ipv4]vpn-target 100:1 export-extcommunity
[ASBR1-vpn-instance-VPNA-af-ipv4]vpn-target 100:1 import-extcommunity
[ASBR1]interface GigabitEthernet0/0/1
[ASBR1-GigabitEthernet0/0/1]ip binding vpn-instance VPNA
Info: All IPv4 related configurations on this interface are removed!
Info: All IPv6 related configurations on this interface are removed!
[ASBR1-GigabitEthernet0/0/1]ip address 192.1.1.1 255.255.255.252
同样的,ISPB中的PE2与ASBR2也需要完成相应配置。
<PE2>system-view
[PE2]ip vpn-instance VPNA
[PE2-vpn-instance-VPNA]ipv4-family
[PE2-vpn-instance-VPNA-af-ipv4]route-distinguisher 200:1
[PE2-vpn-instance-VPNA-af-ipv4]vpn-target 100:1 export-extcommunity
[PE2-vpn-instance-VPNA-af-ipv4]vpn-target 100:1 import-extcommunity
[PE2]interface GigabitEthernet0/0/0
[PE2-GigabitEthernet0/0/0]ip binding vpn-instance VPNA
Info: All IPv4 related configurations on this interface are removed!
Info: All IPv6 related configurations on this interface are removed!
[PE2-GigabitEthernet0/0/0]ip address 200.0.10.1 255.255.255.0
<ASBR2>system-view
[ASBR2]ip vpn-instance VPNA
[ASBR2-vpn-instance-VPNA]ipv4-family
[ASBR2-vpn-instance-VPNA-af-ipv4]route-distinguisher 201:1
[ASBR2-vpn-instance-VPNA-af-ipv4]vpn-target 100:1 export-extcommunity
[ASBR2-vpn-instance-VPNA-af-ipv4]vpn-target 100:1 import-extcommunity
[ASBR2]interface GigabitEthernet0/0/1
[ASBR2-GigabitEthernet0/0/1]ip binding vpn-instance VPNA
Info: All IPv4 related configurations on this interface are removed!
Info: All IPv6 related configurations on this interface are removed!
[ASBR2-GigabitEthernet0/0/1]ip address 192.1.1.2 255.255.255.252
6.配置PE与CE的连通性
根据本实验的设计,PE1-CE1基于静态路由实现连通,PE2-CE2基于BGP实现连通。
在CE1上创建缺省路由。
<CE1>system-view
[CE1]ip route-static 0.0.0.0 0.0.0.0 100.0.10.1
在PE1上为VPN实例VPNA创建静态路由。
<PE1>system-view
[PE1]ip route-static vpn-instance VPNA 192.168.10.0 255.255.255.0 100.0.10.2
接下来,在PE1 BGP视图下使用 命令进入VPN实例VPNA的视图,然后将VPN实例VPNA的静态路由引入BGP。
<PE1>system-view
[PE1]bgp 100
[PE1-bgp]ipv4-family vpn-instance VPNA
[PE1-bgp-VPNA]import-route static
至此,CE1与PE1之间的连通性配置完成,我们来测试下。
<PE1>ping -vpn-instance VPNA 100.0.10.2
PING 100.0.10.1: 56 data bytes, press CTRL_C to break
Reply from 100.0.10.1: bytes=56 Sequence=1 ttl=255 time=20 ms
Reply from 100.0.10.1: bytes=56 Sequence=2 ttl=255 time=1 ms
Reply from 100.0.10.1: bytes=56 Sequence=3 ttl=255 time=1 ms
Reply from 100.0.10.1: bytes=56 Sequence=4 ttl=255 time=1 ms
Reply from 100.0.10.1: bytes=56 Sequence=5 ttl=255 time=1 ms
--- 100.0.10.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 1/4/20 ms
<CE1>ping -a 100.0.10.2 100.0.10.1
PING 100.0.10.1: 56 data bytes, press CTRL_C to break
Reply from 100.0.10.1: bytes=56 Sequence=1 ttl=255 time=140 ms
Reply from 100.0.10.1: bytes=56 Sequence=2 ttl=255 time=30 ms
Reply from 100.0.10.1: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 100.0.10.1: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 100.0.10.1: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 100.0.10.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/46/140 ms
接下来,我们来配置CE2-PE2之间的连通。首先在CE2上创建缺省路由。
<CE2>system-view
[CE2]ip route-static 0.0.0.0 0.0.0.0 200.0.10.1
然后建立CE2与PE2之间的EBGP邻居关系。
<CE2>system-view
[CE2]bgp 300
[CE2-bgp]router-id 8.8.8.8
[CE2-bgp]peer 200.0.10.1 as-number 200
[CE2-bgp]peer 200.0.10.1 next-hop-local
[CE2-bgp]network 192.168.20.0
<PE2>system-view
[PE2]bgp 200
[PE2-bgp]router-id 6.6.6.6
//进入PE2的BGP视图下使用ipv4-family vpn-instance VPNA 命令进入VPN实例VPNA视图,然后与CE2建立邻居关系。
[PE2-bgp]ipv4-family vpn-instance VPNA
[PE2-bgp-VPNA]peer 200.0.10.2 as-number 300
[PE2-bgp-VPNA]peer 200.0.10.2 next-hop-local
配置完成后,查看BGP邻居状态。
<CE2>display bgp peer
BGP local router ID : 8.8.8.8
Local AS number : 300
Total number of peers : 1 Peers in established state : 1
Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv
200.0.10.1 4 200 164 161 0 02:37:54 Established 1
[PE2]display bgp vpnv4 vpn-instance VPNA peer
BGP local router ID : 6.6.6.6
Local AS number : 200
VPN-Instance VPNA, Router ID 6.6.6.6:
Total number of peers : 1 Peers in established state : 1
Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv
200.0.10.2 4 300 162 166 0 02:39:01 Established 1
在PE2 上查看VPN实例VPNA的BGP路由表。
[PE2]display bgp vpnv4 vpn-instance VPNA routing-table
BGP Local router ID is 6.6.6.6
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
VPN-Instance VPNA, Router ID 6.6.6.6:
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 192.168.20.0 200.0.10.2 0 0 300i
此时,我们可以看到VPN实例VPNA仅仅拥有192.168.20.0/24的路由。
在PE2上查看LSP信息。我们发现表中出现了BGP LSP的信息FEC 为192.168.20.0/24,In标签为1026,Out标签为NULL,VRF Name为VPNA,In标签1026应该是由MP-BGP协议分配的内层标签,仅用于区分路由所属的VRF。
[PE2]display mpls lsp
-------------------------------------------------------------------------------
LSP Information: BGP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
192.168.20.0/24 1026/NULL -/- VPNA
-------------------------------------------------------------------------------
LSP Information: LDP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
5.5.5.5/32 NULL/3 -/GE0/0/1
5.5.5.5/32 1024/3 -/GE0/0/1
6.6.6.6/32 3/NULL -/-
4.4.4.4/32 NULL/1025 -/GE0/0/1
4.4.4.4/32 1025/1025 -/GE0/0/1
同样的我们再次查看下PE1 上的LSP信息。也发现出现了BGP LSP的信息,FEC 为192.168.10.0/24。情况和上述类似,In标签1028应该是由MP-BGP协议分配的内层标签,仅用于区分路由所属的VRF。
<PE1>display mpls lsp
-------------------------------------------------------------------------------
LSP Information: BGP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
192.168.10.0/24 1028/NULL -/- VPNA
-------------------------------------------------------------------------------
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 -/-
7.配置ASBR之间的连通,建立EBGP对等体关系(OptionAl方式)
配置到这里,我们发现ISPA 中ASBR1已经收到了192.168.10.0/24的路由,ISPB 中ASBR2收到了192.168.20.0/24的路由,但是都没有对方ISP 中我们想要传递的路由信息。这是由于两边的ISP并没有传递各自的路由信息给对方的ASBR,在这个实验中我们采用OptionA的方式将ASBR进行连通。 具体配置宗旨就要是建立ASBR1与ASBR2的EBGP对等体关系,从而实现两边的路由传递,配置命令比较简单,但是要注意的是,EBGP对等体关系是在ASBR各自的VRF中进行配置,即采用VRF-to-VRF方式互联,传递IPv4路由。
[ASBR1]bgp 100
[ASBR1-bgp]ipv4-family vpn-instance VPNA
[ASBR1-bgp-VPNA]peer 192.1.1.2 as-number 200
[ASBR1]bgp 200
[ASBR1-bgp]ipv4-family vpn-instance VPNA
[ASBR1-bgp-VPNA]peer 192.1.1.1 as-number 100
现在,我们来看下ASBR1、ASBR2 的VPN实例中路由信息。发现我们想要传动的路由信息都已经出现在了对方的ASBR中了,并且被优选。
<ASBR1>dis bgp vpnv4 vpn-instance VPNA routing-table
BGP Local router ID is 3.3.3.3
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
VPN-Instance VPNA, Router ID 3.3.3.3:
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 192.168.10.0 1.1.1.1 0 100 0 ?
*> 192.168.20.0 192.1.1.2 0 200 300i
<ASBR2>dis bgp vpnv4 vpn-instance VPNA routing-table
BGP Local router ID is 201.0.20.4
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
VPN-Instance VPNA, Router ID 201.0.20.4:
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 192.168.10.0 192.1.1.1 0 100?
*>i 192.168.20.0 6.6.6.6 0 100 0 300i
8.查看路由的传递、验证PCA与PCB的连通性
我们继续查看路由信息有没有传递到各自的PE设备上,发现路由已被传递,同时也被加载到了 VPN实例VPNA的 VRF IP路由表中。
<PE1>dis bgp vpnv4 vpn-instance VPNA routing-table
BGP Local router ID is 1.1.1.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
VPN-Instance VPNA, Router ID 1.1.1.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.20.0 3.3.3.3 100 0 200 300i
<PE2>dis bgp vpnv4 vpn-instance VPNA routing-table
BGP Local router ID is 6.6.6.6
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
VPN-Instance VPNA, Router ID 6.6.6.6:
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 192.168.10.0 4.4.4.4 100 0 100?
*> 192.168.20.0 200.0.10.2 0 0 300i
<PE1>display ip routing-table vpn-instance VPNA
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: VPNA
Destinations : 7 Routes : 7
Destination/Mask Proto Pre Cost Flags NextHop Interface
100.0.10.0/24 Direct 0 0 D 100.0.10.1 GigabitEthernet0/0/0
100.0.10.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
100.0.10.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
192.168.10.0/24 Static 60 0 RD 100.0.10.2 GigabitEthernet0/0/0
192.168.20.0/24 IBGP 255 0 RD 3.3.3.3 GigabitEthernet0/0/1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
<PE2>display ip routing-table vpn-instance VPNA
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: VPNA
Destinations : 7 Routes : 7
Destination/Mask Proto Pre Cost Flags NextHop Interface
192.168.10.0/24 IBGP 255 0 RD 4.4.4.4 GigabitEthernet0/0/1
192.168.20.0/24 EBGP 255 0 RD 200.0.10.2 GigabitEthernet0/0/0
200.0.10.0/24 Direct 0 0 D 200.0.10.1 GigabitEthernet0/0/0
200.0.10.1/32 Direct 0 0 D 127.0.0.1 GigabitEtherne0/0/0
200.0.10.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
现在,我们就可以来验证PCA与PCB之间的通信了。
至此完成PCA与PCB 之间的跨域内网通信的配置。
9.实现PCA、PCB内网用户的上网功能
这部分属于附加的需求配置,跟MPLS VPN跨域配置没有太大的关系,想要了解同学的可以进一步往下配置。 这本部分也是我自己学的MPLS VPN跨域过程中加入的需求,配置过程中也遇到了些小问题,但最终自己摸索解决了,也算是记录下吧。
配置内网用户的上网功能,我们第一个想到的方式在PE设备的出接口上做NAT转换就可以了,非常简单。我就不再详细说了,直接上配置。
首先配置感兴趣流,我们希望除了去往192.168.20.0/24网段的流量都进行NAT转换。
[CE1]acl name NAT 3000
[CE1-acl-adv-NAT]rule 5 deny ip source 192.168.10.0 0.0.0.255 destination 192.168.20.0 0.0.0.255
[CE1-acl-adv-NAT]rule 10 permit ip
再在CE1出接口GigabitEthernet0/0/0进行NAT转换
[CE1]interface GigabitEthernet 0/0/0
[CE1-GigabitEthernet0/0/0]nat outbound 3000
现在我们尝试通过PCA访问外网。发现无法上网。
在CE1的GigabitEthernet0/0/0口抓包查看,发现NAT转换正常,推测可能是路由上的问题。
首先查看CE1上的路由信息,有默认路由,并且下一条指向100.0.10.1,没问题。
接下来检查PE1 VRF上的路由,发现竟然没有101.0.10.0/24和100.0.20.0/24网段的路由信息,那么问题应该就出在这里了,才反应过来,VRF路由表只有PE1与CE1之间的路由条目,而外网的路由条目只存在全局路由表中,VRF IP路由表和全局路由表是不互通的,需要的把外网路由信息引入到VRF IP路由表中才行。
怎样才能把外网路由信息引入到VRF IP路由表中呢,查找了一些方法,说需要将全局路由表和VRF路由表之间做路由泄漏。只要在实例VPNA VRF IP路由表中指定一条去往公网的默认路由,同时在全局路由表指定一条指向VRF的回程路由即可。具体配置如下:
//在全局路由表中配置一条去往100.0.10.0/24网段的路由信息,因为100.0.10.0/24网段属于VRF,所以下一条指向实例vpn-instance VPNA的接口地址。
[PE1]ip route-static 100.0.10.0 255.255.255.0 vpn-instance VPNA 100.0.10.2
//在VRP IP路由表中添加一条默认路由,用于访问公网,由于指定nexthop-address是公网地址而不是源VPN中的地址。如果未配置nexthop-address参数,则表示如果在源VPN实例的转发表中查找不到转发路径,则需要去公网转发表中查找转发路径,因此加了public参数。
[PE1]ip route-static vpn-instance VPNA 0.0.0.0 0.0.0.0 101.0.10.2 public
这时我们发现全局路由表中已经有了去往100.0.10.0/24的路由,说明VRF路由已经引入到了全局路由中。
而实例VPNA 中VRF IP路由表中也有了去往公网的默认路由。
现在我们再来测试下PCA能否访问公网,发现已经能够正常访问公网,同时去往192.168.20.0/24网段的内网流量也能够被正常转发。
七、结束语
好了,到这里我们就完成了PCA既能与PCB跨域内网通信,也能实现访问公网的需求。PCB访问公网的配置和PCA类似,需要在CE2上做些配置,大家可以自行尝试,这里就不再写出来了。文章来源:https://www.toymoban.com/news/detail-476158.html
就到这里吧,以上是个人对MPLS VPN跨域通信的一些理解,如果文章中存在问题或者理解不到位的地方欢迎不吝赐教,与之共同学习交流。文章来源地址https://www.toymoban.com/news/detail-476158.html
到了这里,关于跨域BGP/MPLS IP VPN实验(OptionA方式)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!