01-29-2016 06:57 AM - edited 03-05-2019 03:13 AM
I have a new setup that I am labbing up. I have to add a small MPLS type network into our core OSPF network. The link between the router and core will be an OSPF neighbor, not part of any VRF, and I want to import routes from one VRF into OSPF, and export routes into VRF from OSPF. All this from just one vrf.
router ospf 1
router-id 10.10.100.1
log-adjacency-changes
redistribute connected
network 10.10.100.1 0.0.0.0 area 0
!
router bgp 64518
bgp router-id 10.10.100.1
bgp log-neighbor-changes
neighbor 10.10.100.2 remote-as 64518
neighbor 10.10.100.2 update-source Loopback0
!
address-family ipv4
neighbor 10.10.100.2 activate
neighbor 10.10.100.2 allowas-in
no auto-summary
no synchronization
network 10.200.0.0 mask 255.255.255.0
exit-address-family
!
address-family vpnv4
neighbor 10.10.100.2 activate
neighbor 10.10.100.2 send-community extended
exit-address-family
!
address-family ipv4 vrf Public
neighbor 55.66.77.1 remote-as 4141
neighbor 55.66.77.1 activate
no synchronization
exit-address-family
!
address-family ipv4 vrf Internal
neighbor 10.11.100.0 remote-as 4242
neighbor 10.11.100.0 activate
neighbor 10.11.101.0 remote-as 4242
neighbor 10.11.101.0 activate
neighbor 10.11.102.0 remote-as 4242
neighbor 10.11.102.0 activate
no synchronization
exit-address-family
!
address-family ipv4 vrf External
neighbor 50.60.70.0 remote-as 4242
neighbor 50.60.70.0 activate
no synchronization
network 66.66.88.0 mask 255.255.255.0
exit-address-family network 10.200.0.0 0.0.0.255 area 0
These are the networks I want to import
B 172.17.0.0/16 [20/0] via 10.11.101.0, 17:15:40
B 172.16.0.0/16 [20/0] via 10.11.100.0, 17:15:27
B 172.18.0.0/16 [20/0] via 10.11.102.0, 17:15:32
Then I want to be able to filter routes from OSPF into this VRF. It is the Internal VRF I am interested in. I tried a route map, didn't work, probably because I need it from the ipv4 vrf and not the main BGP table.
ip prefix-list Internal-BGP-OSPF seq 5 permit 172.16.0.0/16
ip prefix-list Internal-BGP-OSPF seq 10 permit 172.17.0.0/16
ip prefix-list Internal-BGP-OSPF seq 15 permit 172.18.0.0/16
!
route-map BGP_OSPF permit 10
match ip address prefix-list Internal-BGP-OSPF
!
route-map BGP_OSPF deny 50
router ospf 1
redistribute bgp 64518 subnets route-map BGP_OSPF
On a side note, I did get inter vrf routing for the External-Public vrf, but one snag is in order for the filter to kick in I had to reboot the router. Is there another command I need for it to flush the tables for the routes to filter?
access-list 99 permit 9.9.9.0 0.0.0.255
access-list 99 permit 60.70.80.0 0.0.0.255
route-map Public-Export permit 10
match ip address 99
set extcommunity rt 1000:4141
01-29-2016 07:13 AM
Following a different line of thought, if I were to put the interface connecting to the core into the Internal VRF, would I be able to tie OSPF from the core to the routers? The core is a set of Juniper switches running OSPF only. I would need to filter traffic to the BGP peers, or summarize them as they have a set prefix limit. As far as the core network is concerned it is not aware it is touching an MPLS network at that point, am I correct?
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide