拓扑图&IP划分如下:
以R1为例,R2~R7同理
interface LoopBack 0
ip address 1.1.1.1 32
interface GigabitEthernet 0/0/0
ip address 12.1.1.1 24
以R2为例,R3~R8同理
ospf 1 router-id 2.2.2.2
area 0
network 23.1.1.1 0.0.0.0
network 24.1.1.1 0.0.0.0
network 2.2.2.2 0.0.0.0
以R2为例,R5&R6同理
bgp 100
router-id 2.2.2.2
peer 5.5.5.5 as-number 100
peer 5.5.5.5 connect-interface LoopBack 0
peer 6.6.6.6 as-number 100
peer 6.6.6.6 connect-interface LoopBack 0
以R2为例,R3~R6同理
mpls lsr-id 2.2.2.2
mpls
mpls ldp
quit
interface g 0/0/1
mpls
mpls ldp
quit
interface g 0/0/2
mpls
mpls ldp
R2,R5&R6同理
bgp 100
ipv4-family vpnv4
peer 5.5.5.5 enable
peer 6.6.6.6 enable
peer 5.5.5.5 next-hop-local
peer 6.6.6.6 next-hop-local
R2,R5&R6同理
ip vpn-instance 1
route-distinguisher 1:1
vpn-target 1:1 export-extcommunity
vpn-target 2:2 3:3 import-extcommunity
int g 0/0/0
undo ip ad
ip binding vpn-instance 1
ip add 12.1.1.2 24
ip route-static vpn-instance 1 1.1.1.1 32 12.1.1.1
R1
R2
R6
R8