R1==============================
int lo 0
ip add 1.1.1.1 255.255.255.255
int f0/0
no sh
int f0/0.12
en do 12
ip add 12.1.1.1 255.255.255.0
router bgp 100
net 1.1.1.1 mask 255.255.255.255
nei 12.1.1.2 remote 200
R2==============================
int lo 0
ip add 2.2.2.2 255.255.255.255
int f0/0
no sh
int f0/0.12
en do 12
ip add 12.1.1.2 255.255.255.0
int f0/0.23
en do 23
ip add 23.1.1.2 255.255.255.0
router ospf 100
net 2.2.2.2 0.0.0.0 a 0
net 23.1.1.2 0.0.0.0 a 0
ip cef
mpl lab pro ldp
mpl lab ran 2000 2999
mpl ldp route lo 0
int f0/0.23
mpl i
router bgp 200
nei 12.1.1.1 remote 100
nei 4.4.4.4 remote 200
nei 4.4.4.4 up lo 0
nei 4.4.4.4 next-hop-s
R3==============================
int lo 0
ip add 3.3.3.3 255.255.255.255
int f0/0
no sh
int f0/0.23
en do 23
ip add 23.1.1.3 255.255.255.0
int f0/0.34
en do 34
ip add 34.1.1.3 255.255.255.0
router ospf 100
net 23.1.1.3 0.0.0.0 a 0
net 34.1.1.3 0.0.0.0 a 0
net 3.3.3.3 0.0.0.0 a 0
ip cef
mpl i
mpl lab pro ldp
mpl lab ran 3000 3999
mpl ldp route lo 0
int f0/0.23
mpl i
int f0/0.34
mpl i
R4==============================
int lo 0
ip add 4.4.4.4 255.255.255.255
int f0/0
no sh
int f0/0.34
en do 34
ip add 34.1.1.4 255.255.255.0
int f0/0.45
en do 45
ip add 45.1.1.4 255.255.255.0
router ospf 100
net 4.4.4.4 0.0.0.0 a 0
net 34.1.1.4 0.0.0.0 a 0
ip cef
mpl i
mpl lab pro ldp
mpl lab ran 4000 4999
mpl ldp route lo 0
int f0/0.34
mpl i
router bgp 200
nei 45.1.1.5 remote 300
nei 2.2.2.2 remote 200
nei 2.2.2.2 up lo 0
nei 2.2.2.2 next-hop-s
R5==============================
int lo 0
ip add 5.5.5.5 255.255.255.255
int f0/0
no sh
int f0/0.45
en do 45
ip add 45.1.1.5 255.255.255.0
router bgp 300
nei 45.1.1.4 remote 200
net 5.5.5.5 mask 255.255.255.255
在R2,R4上配置
no mpls ip propagate-ttl
此命令的作用是隐藏运营商的内部标签,出于安全性的考虑.
R1 traceroute -----------测试