MPLS ×××配置实例_第1张图片

R1===================================================================================

hostname R1


ip cef


interface Loopback0

ip address 1.1.1.1 255.255.255.0

!

interface FastEthernet0/0

ip address 12.1.1.1 255.255.255.0

!

router ospf 1

router-id 1.1.1.1

log-adjacency-changes

network 0.0.0.0 255.255.255.255 area 0


R2===================================================================================

hostname R2

no ip domain lookup

!

ip vrf R1_R2

rd 234:2

route-target export 234:2

route-target import 234:4

!

ip cef

ip audit po max-events 100

mpls label range 200 299

mpls label protocol ldp

tag-switching tdp router-id Loopback0

!

interface Loopback0

ip address 2.2.2.2 255.255.255.255

!

interface FastEthernet0/0

ip address 23.1.1.2 255.255.255.0

tag-switching ip

!

interface FastEthernet0/1

ip vrf forwarding R1_R2

ip address 12.1.1.2 255.255.255.0

!

router ospf 110

router-id 2.2.2.2

log-adjacency-changes

network 2.2.2.2 0.0.0.0 area 0

network 23.1.1.2 0.0.0.0 area 0

!

router ospf 1 vrf R1_R2

log-adjacency-changes

redistribute bgp 234 subnets

network 12.1.1.2 0.0.0.0 area 0

!

router bgp 234

no bgp default ipv4-unicast

bgp log-neighbor-changes

neighbor 4.4.4.4 remote-as 234

neighbor 4.4.4.4 update-source Loopback0

!

address-family ***v4

neighbor 4.4.4.4 activate

neighbor 4.4.4.4 send-community extended

exit-address-family

!

address-family ipv4 vrf R1_R2

redistribute ospf 1 match internal external 1 external 2

no auto-summary

no synchronization

exit-address-family


R3=====================================================================================

hostname R3

no ip domain lookup

ip cef

mpls label range 300 399

mpls label protocol ldp

tag-switching tdp router-id Loopback0


interface Loopback0

ip address 3.3.3.3 255.255.255.255

!

interface FastEthernet0/0

ip address 34.1.1.3 255.255.255.0

duplex auto

speed auto

tag-switching ip

!

interface FastEthernet0/1

ip address 23.1.1.3 255.255.255.0

tag-switching ip

!

router ospf 110

router-id 3.3.3.3

log-adjacency-changes

network 3.3.3.3 0.0.0.0 area 0

network 23.1.1.3 0.0.0.0 area 0

network 34.1.1.3 0.0.0.0 area 0


R4===============================================================================

hostname R4

!

no ip domain lookup

!

ip vrf R4_R5

rd 234:4

route-target export 234:4

route-target import 234:2

!

ip cef

ip audit po max-events 100

mpls label range 400 499

mpls label protocol ldp

tag-switching tdp router-id Loopback0


interface Loopback0

ip address 4.4.4.4 255.255.255.255

!

interface FastEthernet0/0

ip vrf forwarding R4_R5

ip address 45.1.1.4 255.255.255.0

duplex auto

speed auto

!

interface FastEthernet0/1

ip address 34.1.1.4 255.255.255.0

duplex auto

speed auto

tag-switching ip

!

router ospf 110

router-id 4.4.4.4

log-adjacency-changes

network 4.4.4.4 0.0.0.0 area 0

network 34.1.1.4 0.0.0.0 area 0

!

router ospf 1 vrf R4_R5

log-adjacency-changes

redistribute bgp 234 subnets

network 45.1.1.4 0.0.0.0 area 0

!

router bgp 234

no bgp default ipv4-unicast

bgp log-neighbor-changes

neighbor 2.2.2.2 remote-as 234

neighbor 2.2.2.2 update-source Loopback0

!

address-family ipv4

neighbor 2.2.2.2 activate

no auto-summary

no synchronization

exit-address-family

!

address-family ***v4

neighbor 2.2.2.2 activate

neighbor 2.2.2.2 send-community extended

exit-address-family

!

address-family ipv4 vrf R4_R5

redistribute ospf 1 match internal external 1 external 2

no auto-summary

no synchronization

exit-address-family


R5=================================================================================

hostname R5

ip cef

interface Loopback0

ip address 5.5.5.5 255.255.255.0

!

interface FastEthernet0/1

ip address 45.1.1.5 255.255.255.0

!

router ospf 1

log-adjacency-changes

network 5.5.5.5 0.0.0.0 area 0

network 45.1.1.5 0.0.0.0 area 0


注:R2和R4建立IBGP的邻接关系

若R2与R3建立IBGP,R3与R4建立IBGP,则R3应作为RR,配置如下
R2=====================================================================
router bgp 234
 no bgp default ipv4-unicast
 bgp log-neighbor-changes
 neighbor 3.3.3.3 remote-as 234
 neighbor 3.3.3.3 update-source Loopback0
 !
 address-family ***v4
 neighbor 3.3.3.3 activate
 neighbor 3.3.3.3 send-community extended
 R3=====================================================================
 router bgp 234
 no bgp default ipv4-unicast
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 234
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 4.4.4.4 remote-as 234
 neighbor 4.4.4.4 update-source Loopback0
 !
 address-family ***v4
 neighbor 2.2.2.2 activate
 neighbor 2.2.2.2 route-reflector-client
 neighbor 2.2.2.2 send-community extended
 neighbor 4.4.4.4 activate
 neighbor 4.4.4.4 route-reflector-client
 neighbor 4.4.4.4 send-community extended
 R4======================================================================
 router bgp 234
 no bgp default ipv4-unicast
 bgp log-neighbor-changes
 neighbor 3.3.3.3 remote-as 234
 neighbor 3.3.3.3 update-source Loopback0
 !
 address-family ipv4
 neighbor 2.2.2.2 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