拓扑图规划如图所示
首先先配置CE设备
ipv6
interface GigabitEthernet0/0/0
ipv6 enable
ipv6 address 2000:17::7/64
interface LoopBack0
ipv6 enable
ipv6 address 2000:7::7/128
并且与PE建立ipv6的bgp邻居
bgp 65000
router-id 7.7.7.7
peer 2000:17::1 as-number 100
#
ipv4-family unicast
undo synchronization
#
ipv6-family unicast
undo synchronization
network 2000:7::7 128
peer 2000:17::1 enable
PE设备配置ipv6地址以及ipv4地址并且跑ospf以及mpls ldp
interface GigabitEthernet0/0/0
ipv6 enable
ipv6 address 2000:17::1/64
interface GigabitEthernet0/0/1
ip address 12.0.0.1 255.255.255.0
mpls
mpls ldp
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
ospf 1
area 0.0.0.0
network 1.1.1.1 0.0.0.0
network 12.0.0.1 0.0.0.0
mpls lsr-id 1.1.1.1
mpls
mpls ldp
P设备配置:
interface GigabitEthernet0/0/0
ip address 12.0.0.2 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet0/0/1
ip address 23.0.0.2 255.255.255.0
mpls
mpls ldp
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
ospf 1
area 0.0.0.0
network 0.0.0.0 255.255.255.255
mpls lsr-id 2.2.2.2
mpls
mpls ldp
ASBR同理:
interface GigabitEthernet0/0/0
ip address 23.0.0.3 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet0/0/1
ip address 34.0.0.3 255.255.255.0
mpls
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
#ospf 1
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 23.0.0.3 0.0.0.0
#
mpls lsr-id 3.3.3.3
mpls
#
mpls ldp
AS200的设备同理,这里不再赘述
创建实例并且绑定接口
ip vpn-instance 10
ipv6-family
route-distinguisher 100:100
vpn-target 100:100 export-extcommunity
vpn-target 100:100 import-extcommunity
interface GigabitEthernet0/0/0
ip binding vpn-instance 10
然后R1与R6建立MP-BGP邻居,传递VPNV6路由,其余的和MPLS VPN C1一样
bgp 100
router-id 1.1.1.1
peer 3.3.3.3 as-number 100
peer 3.3.3.3 connect-interface LoopBack0
peer 6.6.6.6 as-number 200
peer 6.6.6.6 ebgp-max-hop 255
peer 6.6.6.6 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 3.3.3.3 enable
peer 3.3.3.3 label-route-capability
peer 6.6.6.6 enable
#
ipv6-family unicast
undo synchronization
peer 3.3.3.3 enable
peer 3.3.3.3 label-route-capability
#
ipv6-family vpnv6
policy vpn-target
peer 6.6.6.6 enable
#
ipv6-family vpn-instance 10
peer 2000:17::7 as-number 65000
ASBR之间的策略
route-policy asbr permit node 10
apply mpls-label
#
route-policy pe permit node 10
if-match mpls-label
apply mpls-label
应用策略
peer 1.1.1.1 route-policy pe export
peer 34.0.0.4 route-policy asbr export
并且打开标签交换能力
peer 1.1.1.1 label-route-capability
peer 34.0.0.4 label-route-capability
在ASBR之间network pe的环回口,让pe之间互相学习到环回口路由用来建立mp-bgp邻居,传递vpnv6路由
network 1.1.1.1 255.255.255.255
在pe上查看bgp vpnv6邻居
查看vpnv6的路由
Ce互相ping一下
查看vpnv6的标签
去往2000:8::8的出标签为1027,这是私网标签
再查看BGP分配的标签以及mpls ldp分配的标签