实验拓扑
Ip地址规划为9.9.X.X/24
例子:R1的gi0/0----9.9.12.1/24
R2的gi0/0----9.9.12.2/24
每个设备的环回口都为设备的编号
一、完成AS内的完成IGP(略)
二、完成AS内的IBGP邻居的建立(略)(R2和R4,R5和R7之间建立)
三、完成AS内的LDP标签分发
R2------R3-R7同理(AS内部)
mpls ip
mpls router ldp
ldp router-id interface Loopback 0 force
interface GigabitEthernet 0/1
mpls ip
label-switching
查看
四、完成PE(R2、R7)与CE(R1、R8)的OSPF建立(划分到VRF中)
R1/R8
router ospf 10
network 0.0.0.0 255.255.255.255 area 0
R2
ip vrf VPN1
rd 10:1 本地有效
route-target both 1:1 进出的RT值都为1:1
interface GigabitEthernet 0/0
no switchport
ip vrf forwarding VPN1
ip address 9.9.12.2 255.255.255.0
router ospf 10 vrf VPN1
network 9.9.12.2 0.0.0.0 area 0
R7
ip vrf VPN8
rd 10:1
route-target both 1:1
interface GigabitEthernet 0/0
no switchport
ip vrf forwarding VPN8
ip address 9.9.78.7 255.255.255.0
router ospf 10 vrf VPN8
network 9.9.78.7 0.0.0.0 area 0
查看
五、激活VPNV4的邻居(R2与R4,R5与R7)
R2
router bgp 234
address-family vpnv4 unicast
neighbor 4.4.4.4 activate
R4
router bgp 234
address-family vpnv4 unicast
neighbor 2.2.2.2 activate
R5
router bgp 567
address-family vpnv4 unicast
neighbor 7.7.7.7 activate
R7
router bgp 567
address-family vpnv4 unicast
neighbor 5.5.5.5 activate
查看
六、在R4与R5建立MPLS-EBGP邻居(VPNV4邻居)
R4
router bgp 234
neighbor 9.9.45.5 remote-as 567
address-family vpnv4 unicast
neighbor 9.9.45.5 activate
R5
router bgp 567
neighbor 9.9.45.4 remote-as 234
address-family vpnv4 unicast
neighbor 9.9.45.4 activate
查看
七、关闭R4、R5、R7的VPNV4的route-target检查
R4
router bgp 234
no bgp default route-target filter
R5、R7
router bgp 567
no bgp default route-target filter
八、打开R4、R5直连链路的标签转发功能
R4、R5
interface GigabitEthernet 0/2
label-switching
九、修改R4、R5的VPNV4的下一条为自己
R4从R5学习到的VPNV4路由传递给R2时下一跳还是R5(下一跳不可达)
R5从R4学习到的VPNV4路由传递给R7时下一跳还是R4(下一跳不可达)
从EBGP学习到的路由传递给IBGP时不会修改下一跳为自己
R4
router bgp 234
address-family vpnv4 unicast
neighbor 2.2.2.2 next-hop-self
R5
router bgp 567
address-family vpnv4 unicast
neighbor 7.7.7.7 next-hop-self
十、把VRF中的OSPF路由宣告进VPNV4中
R2
router bgp 234
address-family ipv4 vrf VPN1
network 1.1.1.1 mask 255.255.255.255
R7
router bgp 567
address-family ipv4 vrf VPN8
network 8.8.8.8 mask 255.255.255.255
查看
十一、在PE(R2,R7)上把学习到的VPNV4路由重发布到VRF的OSPF中并修改类型为type-1
R2
router ospf 10 vrf VPN1
redistribute bgp metric-type 1 subnets
R7
router ospf 10 vrf VPN8
redistribute bgp metric-type 1 subnets
十二、验证(R1,R8)