基础配置:
R1:
interface Loopback0
ip address 1.1.1.1 255.255.255.255
interface FastEthernet0/0
ip address 12.12.12.1 255.255.255.0
duplex auto
speed auto
interface FastEthernet1/0
ip address 14.14.14.1 255.255.255.0
duplex auto
speed auto
router ospf 1
router-id 1.1.1.1
log-adjacency-changes
network 1.1.1.1 0.0.0.0 area 1
network 12.12.12.1 0.0.0.0 area 1
network 14.14.14.1 0.0.0.0 area 1
R2:
interface Loopback0
ip address 2.2.2.2 255.255.255.255
interface FastEthernet0/0
ip address 12.12.12.2 255.255.255.0
duplex auto
speed auto
interface FastEthernet1/0
ip address 23.23.23.2 255.255.255.0
duplex auto
speed auto
router eigrp 100
network 2.2.2.2 0.0.0.0
network 23.23.23.2 0.0.0.0
no auto-summary
router ospf 1 vrf A
router-id 2.2.2.2
log-adjacency-changes
redistribute bgp 100 subnets
network 12.12.12.2 0.0.0.0 area 1
router bgp 100
bgp router-id 2.2.2.2
bgp log-neighbor-changes
neighbor 3.3.3.3 remote-as 100
neighbor 3.3.3.3 update-source Loopback0
!
address-family ipv4
neighbor 3.3.3.3 activate
no auto-summary
no synchronization
exit-address-family
!
address-family ***v4
neighbor 3.3.3.3 activate
neighbor 3.3.3.3 send-community extended
exit-address-family
!
address-family ipv4 vrf A
redistribute ospf 1 vrf A match internal external 1 external 2
no synchronization
exit-address-family
mpls ldp router-id Loopback0 force
R3:
interface Loopback0
ip address 3.3.3.3 255.255.255.255
interface FastEthernet0/0
ip address 23.23.23.3 255.255.255.0
duplex auto
speed auto
interface FastEthernet1/0
ip address 34.34.34.3 255.255.255.0
duplex auto
speed auto
router eigrp 100
network 3.3.3.3 0.0.0.0
network 23.23.23.3 0.0.0.0
no auto-summary
router ospf 1 vrf A
router-id 3.3.3.3
log-adjacency-changes
redistribute bgp 100 subnets
network 34.34.34.3 0.0.0.0 area 1
router bgp 100
no synchronization
bgp router-id 3.3.3.3
bgp log-neighbor-changes
neighbor 2.2.2.2 remote-as 100
neighbor 2.2.2.2 update-source Loopback0
no auto-summary
!
address-family ***v4
neighbor 2.2.2.2 activate
neighbor 2.2.2.2 send-community extended
exit-address-family
!
address-family ipv4 vrf A
redistribute ospf 1 vrf A match internal external 1 external 2
no synchronization
exit-address-family
mpls ldp router-id Loopback0 force
R4:
interface Loopback0
ip address 4.4.4.4 255.255.255.255
interface FastEthernet0/0
ip address 34.34.34.4 255.255.255.0
duplex auto
speed auto
interface FastEthernet1/0
ip address 14.14.14.4 255.255.255.0
duplex auto
speed auto
router ospf 1
router-id 4.4.4.4
log-adjacency-changes
network 4.4.4.4 0.0.0.0 area 1
network 14.14.14.4 0.0.0.0 area 1
network 34.34.34.4 0.0.0.0 area 1
查看:
R2去往4.4.4.4和34.34.34.0/24走的是R1,路由选择走的是OSPF区域而不是MPLS ×××骨干
R1去往远程站点走的也是后门链路
创建Sham-link
R2:
interface Loopback1
ip vrf forwarding A
ip address 100.100.100.1 255.255.255.255 //单独分配一个32位的地址给sham-link,并且放入VRF中
router bgp 100
address-family ipv4 vrf A
network 100.100.100.1 mask 255.255.255.255 //在BGP VRF中宣告
router ospf 1 vrf A
area 1 sham-link 100.100.100.1 100.100.100.2 //在PE之间创建区域一的sham-link
R3:
interface Loopback1
ip vrf forwarding A
ip address 100.100.100.2 255.255.255.255 //单独分配一个32位的地址给sham-link,并且放入VRF中
router bgp 100
address-family ipv4 vrf A
network 100.100.100.2 mask 255.255.255.255 //在BGP VRF中宣告
router ospf 1 vrf A
area 1 sham-link 100.100.100.2 100.100.100.1 //在PE之间创建区域一的sham-link
R1:
int f1/0
ip ospf cost 10000
R4:
int f1/0
ip ospf cost 10000
现在R1走的MPLS ×××骨干去往远程站点
转载于:https://blog.51cto.com/q3322095/919568