CE1
-------------
en
conf t
no ip domain-lookup
ip classless
ip subnet-zero
hostname CE1
int e2/0
ip add 192.168.1.1 255.255.255.0
no shu
int s1/0
ip add 192.168.2.1 255.255.255.0
no shu
ip route 0.0.0.0 0.0.0.0 192.168.2.2
PE1
------------------
en
conf t
no ip domain-lookup
ip classless
ip subnet-zero
hostname PE1
service timestamps debug uptime
service timestamps log uptime
no parser cache
ip cef
ip vrf vpna
rd 1:100
route-target export 200:1
route-target import 200:1
exit
int s1/1
ip add 192.168.3.1 255.255.255.0
tag-switching ip
tag-switching mtu 1500
ip ospf cost 100
no shu
int s1/0
ip add 192.168.2.2 255.255.255.0
ip vrf forwarding vpna
tag-switching ip
no shu
int s1/2
ip add 192.168.4.1 255.255.255.0
tag-switching ip
tag-switching mtu 1500
ip ospf cost 20
no shu
router ospf 100
log-adjacency-changes
redistribute connected
redistribute static
net 192.168.3.0 0.0.0.255 area 0
net 192.168.4.0 0.0.0.255 area 0
exit
router bgp 100
no bgp default ipv4-unicast
bgp log-neighbor-changes
neighbor 192.168.4.2 remote-as 100
neighbor 192.168.4.2 version 4
neighbor 192.168.4.2 activate
address-family ipv4 vrf vpna
redistribute connected
redistribute static
no auto-summary
no synchronization
exit-address-family
ip route vrf vpna 192.168.1.0 255.255.255.0 192.168.2.1
ip ospf name-lookup
exit
P
-----------
en
conf t
no ip domain-lookup
ip classless
ip subnet-zero
service timestamps debug uptime
service timestamps log uptime
hostname P
ip cef
ip http server
ip pim bidir-enable
int s1/0
ip add 192.168.3.2 255.255.255.0
ip ospf cost 20
tag-switching mtu 1500
tag-switching ip
no shu
int s1/1
ip add 192.168.5.1 255.255.255.0
ip ospf cost 20
tap-switching mtu 1500
tap-switching ip
no shu
router ospf 100
log-adjacency-changes
redistribute connected
redistribute static
net 192.168.3.2 0.0.0.0 area 0
net 192.168.5.1 0.0.0.0 area 0
exit
PE2
---------
en
conf t
no ip domain-lookup
ip classless
ip subnet-zero
hostname PE2
service timestamps debug uptime
service timestamps log uptime
no parser cache
ip cef
int s1/0
ip add 192.168.5.2 255.255.255.0
tag-switching mtu 1500
tap-switching ip
ip ospf cost 20
no shu
int s1/2
ip add 192.168.4.2 255.255.255.0
ip ospf cost 100
tag-switching mtu 1500
tap-switching ip
no shu
int s1/1
ip add 192.168.6.1 255.255.255.0
ip vrf forwarding vpna
tap-switching ip
no shu
router ospf 100
log-adjacency-changes
redistribute connected
redistribute static
net 192.168.5.0 0.0.0.255 area 0
net 192.168.4.0 0.0.0.255 area 0
exit
router bgp 100
no bgp default ipv4-unicast
bgp log-neighbor-changes
neighbor 192.168.4.1 remote-as 100
neighbor 192.168.4.1 version 4
neighbor 192.168.4.1 activate
address-family ipv4 vrf vpna
redistribute connected
redistribute static
no auto-summary
no synchronization
exit-address-family
ip vrf vpna
rd 1:100
route-target export 200:1
route-target import 200:1
exit
ip route vrf vpna 192.168.7.0 255.255.255.0 192.168.6.2
ip ospf name-lookup
exit
CE2
-------
en
conf t
no ip domain-lookup
ip classless
ip subnet-zero
hostname CE2
int s1/0
ip add 192.168.6.2 255.255.255.0
no shu
int e2/0
ip add 192.168.7.1 255.255.255.0
no shu
exit
ip route 0.0.0.0 0.0.0.0 192.168.6.1
查看配置:show mpls ldp neighbor查看邻居
show mpls ldp igp sync all 查看接口
ping测试的时候 “U U U”表示不可达