VRF、MB-BGP配置例子
原创
©著作权归作者所有:来自51CTO博客作者ajd1234的原创作品,请联系作者获取转载授权,否则将追究法律责任
拓朴如下图:
说明:
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 vpnv4
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 vpnv4
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
!
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
VRF配置实例
vrf实例
ci Standard Time