1.实验拓补图
2.ip配置
R1
ip address 192.128.2.1 24
int l 0
ip address 192.168.1.1 24
R2
ip address 23.1.1.1 24
ip address 2.2.2.2 24
R3
ip address 23.1.1.2 24
int g0/0/1
ip address 34.1.1.1 24
ip address 3.3.3.3 24
R4
ip address 34.1.1.2 24
int l 0
ip address 4.4.4.4 24
R5
int g0/0/0
ip address 192.168.3.2 24
int l 0
ip address 192.168.4.1 24
R6
int g0/0/0
ip address 192.168.2.1 24
int l 0
ip address 192.168.1.1 24
R7
int g0/0/0
ip address 192.168.3.2 24
int l0
ip address 192.168.4.1 24
R2
mpls lsr-id 2.2.2.2
mpls
mpls ldp
int g0/0/1
mpls
mpls ldp
R3
mpls lsr-id 3.3.3.3
mpls
mpls ldp
int g0/0/0
mpls
mpls ldp
int g0/0/1
公网配置BGP协议
R2
bgp 1
router-id 2.2.2.2
peer 4.4.4.4 as-number 1
peer 4.4.4.4 connect-interface LoopBack 0
ipv4-family vpnv4
peer 4.4.4.4 enable
bgp 1
router-id 4.4.4.4
peer 2.2.2.2 as-number 1
peer 2.2.2.2 connect-interface LoopBack 0
ipv4-family vpnv4
peer 2.2.2.2 enable
a1 rip
rip 1
version 2
network 192.168.1.0
network 192.168.2.0
rip 1 vpn-instance a1
network 192.168.2.0
a2 ospf
ospf 1 router-id 7.7.7.7
area 0
network 0.0.0.0 255.255.255.255
ospf 2 router-id 4.4.4.4 v
ospf 2 router-id 4.4.4.4 vpn-instance a2
area 0
network 192.168.3.1 0.0.0.0
-
[r2]bgp 1
-
[r2-bgp]ipv4-family vpn-instance a1
-
[r2-bgp-a1]import-route rip 1
R4
ospf 2 vpn-instance a2
import-route bgp
bgp 1
ipv4-family vpn-instance a2
import-route ospf 2
R2
rip 1 vpn-instance a1
impo
import-route bgp
R1
ip route-static 192.168.3.0 24 192.168.2.1
ip route-static 192.168.4.0 24 192.168.2.1
R5
ip route-static 192.168.1.0 24 192.168.3.1
ip route-static 192.168.2.0 24 192.168.3.1
R2
ip route-static vpn-instance b1 192.168.1.0 24 192.168.2.2
R4
ip route-static vpn-instance b2 192.168.4.0 24 192.168.3.2
R2
bgp 1
ipv4-family vpn-instance b1
import-route direct
import-route static
bgp 1
ipv4 vpn-instance b2
import-route direct
import-route static