07-26-2023 10:38 AM - last edited on 07-27-2023 09:33 PM by Translator
Hi all,
i have a question about importing routes inside a
vrf
Right now, in
vrf red
i'm importing some routes from global routing table and also from
vrf blue
vrf definition blue
rd 1:4102
!
address-family ipv4
route-target export 1:4102
exit-address-family
!
vrf definition red
rd 1:4099
!
address-family ipv4
import ipv4 unicast map GLOBAL-TO-RED
route-target export 1:4099
route-target import 1:4102
exit-address-family
now i want to limit imported routs from
vrf blue using a route map
but when i try to define an
import map
inside the address-family of the
vrf
i display following error:
Router(config)#vrf definition red
Router(config-vrf)#address-family ipv4
Router(config-vrf-af)#import map testmap
Disable IPv4 Unicast import first
so how can i filter routes imported from
vrf blue
? do i need to export routes from
vrf blue
to global routing table and then import them from GRT using a single
route-map
or there are other ways?
Thanks in advance,
Alessandro
Solved! Go to Solution.
07-26-2023 01:19 PM - last edited on 07-27-2023 09:41 PM by Translator
Can you check command
Route-replicate
is it available in your router or not?
07-26-2023 10:41 AM - last edited on 07-27-2023 09:34 PM by Translator
Router(config-vrf-af)#import ipv4 unicast map testmap
Add this and try
07-26-2023 10:51 AM - last edited on 07-27-2023 09:40 PM by Translator
Hi MHM,
thanks for your kind reply, maybe i was not able to explain it right. What you're suggesting is already configured inside
vrf red
and i'm correctly importing "limited"
(by route-map GLOBAL-TO-RED)
routes from GRT and routes from
vrf blue
due the
route-target import 1:4102
command. What i wanted to do now is to limit imported routes from
vrf blue
with a
route map using the import map [map name]
command but as you can see in my post i display a message telling me to remove the
import ipv4 unicast map
command.
07-26-2023 10:54 AM - last edited on 07-27-2023 09:40 PM by Translator
i understand now you're telling me to add another
unicast map
command but doing this i will only replace the existing one and not adding a second one
07-26-2023 01:19 PM - last edited on 07-27-2023 09:41 PM by Translator
Can you check command
Route-replicate
is it available in your router or not?
07-27-2023 02:55 AM - last edited on 07-27-2023 09:47 PM by Translator
Hi MHM,
thanks for your kind reply, i checked and i can confirm the command is available, also, as i wasn't aware of this command, i did some research and tested it and i confirm i was able to achieve my goal!
Briefly, to test, i picked a prefix from GRT and a prefix from
vrf blue
routing table, configured two
prefix-lists
ant two
route maps
to match them. Finally i applied both import
ipv4 unicast and route-replicate command under vrf red
ip prefix-list test_pfx seq 5 permit 172.20.222.0/24
ip prefix-list test2_pfx seq 5 permit 172.16.152.0/24
!
route-map test_map permit 10
match ip address prefix-list test_pfx
route-map test2_map permit 10
match ip address prefix-list test2_pfx
!
vrf definition red
rd 1:4102
!
address-family ipv4
route-replicate from vrf blue unicast all route-map test_map
import ipv4 unicast map test2_map
route-target export 1:4102
exit-address-family
and checked the routing table in
vrf red
again to see if the desired routes was imported:
Router#sh ip route vrf red
Routing Table: red
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, m - OMP
n - NAT, Ni - NAT inside, No - NAT outside, Nd - NAT DIA
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
H - NHRP, G - NHRP registered, g - NHRP registration summary
o - ODR, P - periodic downloaded static route, l - LISP
a - application route
+ - replicated route, % - next hop override, p - overrides from PfR
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
C 10.253.14.188/30 is directly connected, Vlan3132
L 10.253.14.190/32 is directly connected, Vlan3132
C 10.253.14.192/30 is directly connected, Vlan3131
L 10.253.14.194/32 is directly connected, Vlan3131
B 10.253.15.40/32 [20/0] via 10.253.14.193, 1d23h
172.16.0.0/24 is subnetted, 1 subnets
B 172.16.152.0 [20/0] via 10.254.1.106, 00:05:13
172.20.0.0/24 is subnetted, 2 subnets
B + 172.20.222.0 [20/0] via 10.253.14.221 (blue), 4w6d
B 172.20.248.0 [20/0] via 10.253.14.193, 2d00h
Thank you very much for helping me!
Alessandro
07-27-2023 03:04 AM
You are so welcome friend
have a nice summer
MHM
07-27-2023 06:20 AM - last edited on 07-27-2023 09:48 PM by Translator
Thanks MHM, same to you!
just to go further, i noticed that routes imported by the
route-replicate
command are not advertised to bgp neighbor, as per you know is this a normal behavior? is there a way to advertise this routes to bgp neighbors?
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