no synchronization exit-address-family !
ip route vrf vpna 1.1.1.1 255.255.255.255 192.168.1.1
R3#sh run !
hostname R3 ! ip cef !
interface Loopback0
ip address 3.3.3.3 255.255.255.255 !
interface Ethernet0/0
ip address 100.1.1.5 255.255.255.252 mpls ip !
interface Ethernet0/1
ip address 100.1.1.2 255.255.255.252 mpls ip !
router ospf 1
network 3.3.3.3 0.0.0.0 area 0 network 100.1.1.0 0.0.0.3 area 0 network 100.1.1.4 0.0.0.3 area 0
R4#sh run !
hostname R4 ! ip cef !
ip vrf vpna rd 100:1
route-target export 100:1 route-target import 100:1 !
interface Loopback0
ip address 4.4.4.4 255.255.255.255 !
interface Ethernet0/0
ip address 100.1.1.6 255.255.255.252
mpls ip !
interface Ethernet0/1 ip vrf forwarding vpna
ip address 192.168.2.4 255.255.255.0 !
router ospf 1
network 4.4.4.4 0.0.0.0 area 0 network 100.1.1.4 0.0.0.3 area 0 !
router bgp 100 no synchronization bgp router-id 4.4.4.4
neighbor 2.2.2.2 remote-as 100
neighbor 2.2.2.2 update-source Loopback0 no auto-summary !
address-family vpnv4 neighbor 2.2.2.2 activate
neighbor 2.2.2.2 send-community extended exit-address-family !
address-family ipv4 vrf vpna redistribute static no synchronization exit-address-family !
ip route vrf vpna 5.5.5.5 255.255.255.255 192.168.2.5
R5#sh run !
hostname R5 ! ip cef !
interface Loopback0
ip address 5.5.5.5 255.255.255.255 !
interface Ethernet0/1
ip address 192.168.2.5 255.255.255.0 !
ip route 1.1.1.1 255.255.255.255 192.168.2.4
测试: R1#sh ip rou
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback0 5.0.0.0/32 is subnetted, 1 subnets S 5.5.5.5 [1/0] via 192.168.1.2
C 192.168.1.0/24 is directly connected, Ethernet0/0
R1# ping 5.5.5.5 source 1.1.1.1 Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds: Packet sent with a source address of 1.1.1.1 !!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 80/99/124 ms
R1#traceroute Protocol [ip]:
Target IP address: 5.5.5.5 Source address: 1.1.1.1 Numeric display [n]:
Timeout in seconds [3]: Probe count [3]:
Minimum Time to Live [1]: Maximum Time to Live [30]: Port Number [33434]:
Loose, Strict, Record, Timestamp, Verbose[none]: Type escape sequence to abort. Tracing the route to 5.5.5.5
1 192.168.1.2 44 msec 40 msec 32 msec
2 100.1.1.2 [MPLS: Labels 17/19 Exp 0] 128 msec 92 msec 92 msec 3 192.168.2.4 [MPLS: Label 19 Exp 0] 92 msec 64 msec 92 msec 4 192.168.2.5 92 msec * 100 msec