网络通信 频道

VRF Selection using by source ip

使用了这个featur e后,就不需要在接口上应用ip vrf forwarding了,pe会根据上来数据包的源地址把数据包划分到相应的vrf中,当然这样做带来了方便,但性能上的下降也相当大。还有一种方法就是用route-map来实现vrf selection,这样更灵活,甚至可以根据ip precedence来划分vrf了。不过cisco的ios没有同时支持使用source ip和route-map做vrf selection的。

R1
hostname R1
!
interface Loopback10
description SiteA
ip address 172.16.10.1 255.255.255.255
no ip directed-broadcast
!
interface Loopback20
description SiteB
ip address 172.16.20.1 255.255.255.255
no ip directed-broadcast
!
interface Ethernet1/2
ip address 192.168.12.1 255.255.255.0
no ip directed-broadcast
full-duplex
!
ip route 0.0.0.0 0.0.0.0 192.168.12.2

R2
hostname R2
!
ip cef
ip vrf SiteA
rd 100:100
route-target export 100:100
route-target import 100:100
!        
ip vrf SiteB
rd 100:200
route-target export 100:200
route-target import 100:200
!
mpls label protocol ldp
vrf selection source 172.16.10.0 255.255.255.0 vrf SiteA
vrf selection source 172.16.20.0 255.255.255.0 vrf SiteB
!
interface Loopback0
ip address 2.2.2.2 255.255.255.255
no ip directed-broadcast
!
interface Ethernet1/1
ip vrf select source
ip vrf receive SiteA
ip vrf receive SiteB
ip address 192.168.12.2 255.255.255.0
no ip directed-broadcast
full-duplex
!
interface Ethernet1/3
ip address 192.168.23.2 255.255.255.0
no ip directed-broadcast
full-duplex
tag-switching ip
!        
router ospf 100
router-id 2.2.2.2
log-adjacency-changes
network 2.2.2.2 0.0.0.0 area 0
network 192.168.23.0 0.0.0.255 area 0
!
router bgp 100
no synchronization
bgp router-id 2.2.2.2
bgp log-neighbor-changes
neighbor 4.4.4.4 remote-as 100
neighbor 4.4.4.4 update-source Loopback0
no auto-summary
!
address-family vpnv4
neighbor 4.4.4.4 activate
neighbor 4.4.4.4 send-community both
exit-address-family
!
address-family ipv4 vrf SiteB
redistribute static
no synchronization
exit-address-family
!
address-family ipv4 vrf SiteA
redistribute static
no synchronization
exit-address-family
!
ip route vrf SiteA 172.16.10.1 255.255.255.255 192.168.12.1
ip route vrf SiteB 172.16.20.1 255.255.255.255 192.168.12.1
!
tag-switching tdp router-id Loopback0

R3
hostname R3
!
ip cef
mpls label protocol ldp
!
interface Loopback0
ip address 3.3.3.3 255.255.255.255
no ip directed-broadcast
!
interface Ethernet1/2
ip address 192.168.23.3 255.255.255.0
no ip directed-broadcast
full-duplex
tag-switching ip
!
interface Ethernet1/4
ip address 192.168.34.3 255.255.255.0
no ip directed-broadcast
full-duplex
tag-switching ip
!
router ospf 100
router-id 3.3.3.3
log-adjacency-changes
network 3.3.3.3 0.0.0.0 area 0
network 192.168.23.0 0.0.0.255 area 0
network 192.168.34.0 0.0.0.255 area 0
!
tag-switching tdp router-id Loopback0

R4
hostname R4
!
ip cef
ip vrf SiteA
rd 100:100
route-target export 100:100
route-target import 100:100
!        
ip vrf SiteB
rd 100:200
route-target export 100:200
route-target import 100:200
!
mpls label protocol ldp
vrf selection source 172.16.10.0 255.255.255.0 vrf SiteA
vrf selection source 172.16.20.0 255.255.255.0 vrf SiteB
!
interface Loopback0
ip address 4.4.4.4 255.255.255.255
no ip directed-broadcast
!
interface Ethernet1/3
ip address 192.168.34.4 255.255.255.0
no ip directed-broadcast
full-duplex
tag-switching ip
!
interface Ethernet1/5
ip vrf select source
ip vrf receive SiteA
ip vrf receive SiteB
ip address 192.168.45.4 255.255.255.0
no ip directed-broadcast
full-duplex
!
router ospf 100
router-id 4.4.4.4
log-adjacency-changes
network 4.4.4.4 0.0.0.0 area 0
network 192.168.34.0 0.0.0.255 area 0
!
router bgp 100
no synchronization
bgp router-id 4.4.4.4
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 vpnv4
neighbor 2.2.2.2 activate
neighbor 2.2.2.2 send-community both
exit-address-family
!
address-family ipv4 vrf SiteB
redistribute static
no synchronization
exit-address-family
!
address-family ipv4 vrf SiteA
redistribute static
no synchronization
exit-address-family
!
ip route vrf SiteA 172.16.10.5 255.255.255.255 192.168.45.5
ip route vrf SiteB 172.16.20.5 255.255.255.255 192.168.45.5
!
tag-switching tdp router-id Loopback0

R5
hostname R5
!
interface Loopback10
description SiteA
ip address 172.16.10.5 255.255.255.255
no ip directed-broadcast
!
interface Loopback20
description SiteB
ip address 172.16.20.5 255.255.255.255
no ip directed-broadcast
!
interface Ethernet1/4
ip address 192.168.45.5 255.255.255.0
no ip directed-broadcast
full-duplex
!        
ip route 0.0.0.0 0.0.0.0 192.168.45.4
 
0
相关文章