拓朴如下图:
说明:
1
、使用使用
VRF-PBR
使连到同一
PE
上的多个
VRF
间可以互通。
2
、使用
MP BGP
使用同一
×××
的不同点、不同
×××
间可以互通。
配置说明:
1
、
R5
、
R6
无过多配置,只有接口
IP
地址、
RIP
的配置。
2
、在
R4
上配置
VRF PBR
使用
R5
与
R6
之间
PING
通。
3
、
R2\R3\R4
启
OSPF
、
MPLS IP
,并在
R2\R4
启
MP BGP
4
、
R2
启针计
CE
的
RIP
;并在
R2\R4
上把
RIP
和
MP BGP
之间相互重分发。
配置如下:
hostname R6
!
!
interface Loopback1
ip address 6.0.0.6 255.255.255.0
!
interface FastEthernet0/0
ip address 192.168.46.6 255.255.255.0
duplex auto
speed auto
!
ip route 0.0.0.0 0.0.0.0 192.168.46.4
\\ R6
上的不启用任何的路由协议,采用默认路由。
hostname R5
!
no ip domain lookup
no ipv6 cef
!
interface Loopback1
ip address 5.0.0.5 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.45.5 255.255.255.0
duplex auto
speed auto
!
router rip
version 2
network 5.0.0.0
network 192.168.45.0
no auto-summary
!
\\ R5
的
RIP
配置主要通
R4
的
×××15
进行路由,学习到
R1
上
×××15
的路由
hostname R1
!
ip vrf 15
\\ VRF
配置
rd 1:5
route-target export 1:5
route-target import 1:5
route-target export 1:100
route-target import 1:100
!
ip vrf 16
rd 1:6
route-target export 1:6
route-target import 1:6
route-target export 1:100
route-target import 1:100
!
interface Loopback15
ip vrf forwarding 15
ip address 15.0.0.1 255.255.255.0
!
interface Loopback16
ip vrf forwarding 16
ip address 16.0.0.1 255.255.255.0
!
interface FastEthernet0/0
ip vrf forwarding 15
\\
将
F0/0
接口划入
×××15
ip address 192.168.1.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip vrf forwarding 16
ip address 192.168.2.1 255.255.255.0
duplex auto
speed auto
!
router rip
version 2
no auto-summary
!
address-family ipv4 vrf 16
\\
启用
VRF
路由
RIP
network 16.0.0.0
network 192.168.2.0
no auto-summary
version 2
exit-address-family
!
address-family ipv4 vrf 15
network 15.0.0.0
network 192.168.1.0
no auto-summary
version 2
exit-address-family
!
hostname R3
!
ip cef
mpls ip
mpls label protocol ldp
!
interface Ethernet1/0
ip address 192.168.23.3 255.255.255.0
duplex half
mpls label protocol ldp
mpls ip
!
interface Ethernet1/1
ip address 192.168.34.3 255.255.255.0
duplex half
mpls label protocol ldp
mpls ip
!
router ospf 1
network 192.168.23.0 0.0.0.255 area 0
network 192.168.34.0 0.0.0.255 area 0
!
hostname R4
ip cef
!
no ip domain lookup
ip vrf 15
rd 1:5
route-target export 1:5
route-target import 1:5
route-target export 1:
100
route-target import 1:
100
!
ip vrf 16
rd 1:6
route-target export 1:6
route-target import 1:6
route-target export 1:
100
route-target import 1:
100
!
mpls label protocol ldp
!
interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface Loopback1
ip address 4.0.0.4 255.255.255.0
!
interface FastEthernet0/0
ip vrf forwarding 15
ip address 192.168.45.4 255.255.255.0
ip policy route-map 15
\\
在使用
R5pingR6
是使用的
PBR
,
MPBGP
时要删除
duplex auto
speed auto
!
interface FastEthernet0/1
ip vrf forwarding 16
ip address 192.168.46.4 255.255.255.0
ip policy route-map 16
\\
在使用
R5pingR6
是使用的
PBR
,
MPBGP
时要删除
duplex auto
speed auto
!
interface Ethernet1/0
ip address 192.168.34.4 255.255.255.0
duplex half
mpls label protocol ldp
mpls ip
!
router ospf 1
log-adjacency-changes
network 4.0.0.0 0.0.0.255 area 0
network 4.4.4.0 0.0.0.255 area 0
network 192.168.34.0 0.0.0.255 area 0
!
router rip
!
address-family ipv4 vrf 15
redistribute bgp 65533 metric transparent
\\
重分发
network 192.168.45.0
no auto-summary
version 2
exit-address-family
!
router bgp 65533
no synchronization
bgp log-neighbor-changes
neighbor 2.2.2.2 remote-as 65533
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 16
redistribute static
\\
重分发
no synchronization
exit-address-family
!
address-family ipv4 vrf 15
redistribute static
redistribute rip
\\
重分发
no synchronization
exit-address-family
!
ip route vrf 16 6.0.0.0 255.255.255.0 192.168.46.6
!
access-list 100 permit ip host 192.168.45.5 host 6.0.0.6
access-list 100 permit ip host 5.0.0.5 host 6.0.0.6
access-list 101 permit ip host 192.168.46.6 host 5.0.0.5
access-list 101 permit ip host 6.0.0.6 host 5.0.0.5
!
route-map 15 permit 10
match ip address 100
set ip vrf 16 next-hop 192.168.46.6
\\
关联
VRF 16
的路由
!
route-map 15 permit 20
!
route-map 16 permit 10
match ip address 101
set ip vrf 15 next-hop 192.168.45.5
\\
关联
VRF 15
的路由
!
route-map 16 permit 20
!
hostname R2
ip cef
no ip domain lookup
ip vrf 15
rd 1:5
route-target export 1:5
route-target import 1:5
route-target export 1:
100
route-target import 1:
100
!
ip vrf 16
rd 1:6
route-target export 1:6
route-target import 1:6
route-target export 1:
100
route-target import 1:
100
!
interface Loopback1
ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
ip vrf forwarding 15
ip address 192.168.1.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip vrf forwarding 16
ip address 192.168.2.2 255.255.255.0
duplex auto
speed auto
!
interface Ethernet1/0
ip address 192.168.23.2 255.255.255.0
duplex half
mpls label protocol ldp
mpls ip
!
router ospf 1
log-adjacency-changes
network 2.2.2.0 0.0.0.255 area 0
network 192.168.23.0 0.0.0.255 area 0
!
router rip
!
address-family ipv4 vrf 16
network 192.168.2.0
no auto-summary
version 2
exit-address-family
!
address-family ipv4 vrf 15
redistribute bgp 65533 metric transparent
network 192.168.1.0
no auto-summary
version 2
exit-address-family
!
router bgp 65533
no synchronization
bgp log-neighbor-changes
neighbor 4.4.4.4 remote-as 65533
neighbor 4.4.4.4 update-source Loopback1
no auto-summary
!
address-family ***v4
neighbor 4.4.4.4 activate
neighbor 4.4.4.4 send-community extended
exit-address-family
!
address-family ipv4 vrf 16
redistribute static
no synchronization
exit-address-family
!
address-family ipv4 vrf 15
redistribute rip
no synchronization
exit-address-family
!