通过MPLS ×××技术,使得客户A的两个站点可以互访,客户A和客户B之间是不能互访的,现在有需求客户A-1站点要跟客户B互访,可以使用export map给他们分配相同的BGP extented community RT来达到目的。
客户A之间可以互相看到路由
现在要求客户A-1和客户B之间可以互访,但客户A-2和客户B之间不能互访
使用export map后客户A-1可以收到客户B路由
客户B也可以收到客户A-1路由
客户A-2不能收到客户B的路由
配置:
R1:
interface Loopback0
ip address 192.168.0.1 255.255.255.0
!
interface Loopback1
ip address 192.168.1.1 255.255.255.0
!
interface Loopback2
ip address 192.168.2.1 255.255.255.0
!
interface Loopback3
ip address 192.168.3.1 255.255.255.0
!
interface FastEthernet1/0
ip address 12.1.1.1 255.255.255.0
duplex auto
speed auto
!
router bgp 65000
bgp router-id 1.1.1.1
bgp log-neighbor-changes
network 192.168.0.0
network 192.168.1.0
network 192.168.2.0
network 192.168.3.0
neighbor 12.1.1.2 remote-as 1
R2:
ip vrf A
rd 1:1
export map AtoB
route-target export 1:2
route-target import 1:1
!
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet1/0
ip vrf forwarding A
ip address 12.1.1.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/1
ip address 23.1.1.2 255.255.255.0
duplex auto
speed auto
mpls ip
!
!
router eigrp 1
network 2.2.2.2 0.0.0.0
network 23.1.1.2 0.0.0.0
!
router bgp 1
bgp router-id 2.2.2.2
bgp log-neighbor-changes
neighbor 3.3.3.3 remote-as 1
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
exit-address-family
!
address-family ipv4 vrf A
neighbor 12.1.1.1 remote-as 65000
neighbor 12.1.1.1 activate
neighbor 12.1.1.1 as-override
exit-address-family
!
route-map AtoB permit 10
set extcommunity rt 1:6 additive
!
route-map AtoB permit 20
R3:
ip vrf A
rd 1:2
route-target export 1:1
route-target import 1:2
!
ip vrf B
rd 1:6
export map BtoA
route-target export 1:5
route-target import 1:6
!
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface FastEthernet1/0
ip address 23.1.1.3 255.255.255.0
duplex auto
speed auto
mpls ip
!
interface FastEthernet1/1
ip vrf forwarding A
ip address 34.1.1.3 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet2/0
ip vrf forwarding B
ip address 35.1.1.3 255.255.255.0
duplex auto
speed auto
!
router eigrp 1
network 3.3.3.3 0.0.0.0
network 23.1.1.3 0.0.0.0
!
router bgp 1
bgp router-id 3.3.3.3
bgp log-neighbor-changes
neighbor 2.2.2.2 remote-as 1
neighbor 2.2.2.2 update-source Loopback0
!
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
neighbor 34.1.1.4 remote-as 65000
neighbor 34.1.1.4 activate
neighbor 34.1.1.4 as-override
exit-address-family
!
address-family ipv4 vrf B
neighbor 35.1.1.5 remote-as 65001
neighbor 35.1.1.5 activate
exit-address-family
!
route-map BtoA permit 10
set extcommunity rt 1:1 additive
!
route-map BtoA permit 20
R4:
interface Loopback0
ip address 10.1.0.1 255.255.255.0
!
interface Loopback1
ip address 10.1.1.1 255.255.255.0
!
interface Loopback2
ip address 10.1.2.1 255.255.255.0
!
interface Loopback3
ip address 10.1.3.1 255.255.255.0
!
interface FastEthernet1/0
ip address 34.1.1.4 255.255.255.0
duplex auto
speed auto
!
router bgp 65000
bgp router-id 4.4.4.4
bgp log-neighbor-changes
network 10.1.0.0 mask 255.255.255.0
network 10.1.1.0 mask 255.255.255.0
network 10.1.2.0 mask 255.255.255.0
network 10.1.3.0 mask 255.255.255.0
neighbor 34.1.1.3 remote-as 1
R5:
interface Loopback0
ip address 172.16.0.1 255.255.255.0
!
interface Loopback1
ip address 172.16.1.1 255.255.255.0
!
interface Loopback2
ip address 172.16.2.1 255.255.255.0
!
interface Loopback3
ip address 172.16.3.1 255.255.255.0
!
interface FastEthernet1/0
ip address 35.1.1.5 255.255.255.0
duplex auto
speed auto
!
router bgp 65001
bgp router-id 5.5.5.5
bgp log-neighbor-changes
network 172.16.0.0 mask 255.255.255.0
network 172.16.1.0 mask 255.255.255.0
network 172.16.2.0 mask 255.255.255.0
network 172.16.3.0 mask 255.255.255.0
neighbor 35.1.1.3 remote-as 1
转载于:https://blog.51cto.com/q3322095/927329