02-22-2023 04:18 PM
Hi, i am trying to understand how vrf, rd, and route-target import/export works. I have this simple topology and i am running iBGP between the routers in vrf 865, neighborship has been established and i have configured same rd and route-target on both routers.
Now what i want to do is to export/import routes between R1 and R2 using route-target import/export. I have added loop0 on R1 into the same vrf 865 and per my understanding this should export the ip address on the loopback interface into vrf 865 on R2 via iBGP. But i cant see R2 receiving any imported route into that vrf 865. Basically what i want to do is to advertise routes through iBGP without using the network command. I just want to export the route. Can anyone help me or guide me to understand how this works? Thank You in advance!
Topology:
R1 vrf configuration and IBGP.
Solved! Go to Solution.
02-22-2023 04:36 PM - edited 02-22-2023 04:47 PM
Hello,
I believe you need to advertise the routes regardless. The import/exports just says this is/is not allowed to be imported/exported into the VRF once it gets to its destination. Similar to MPLS L3VPN, the VRF are redistributed into BGP vpnv4 table (the Route Distinguisher keeps the routes separate). Then it advertises its table to the other iBGP peer on the other side and the import/export tags determine what VRF the routes can go into.
The fundamental underlying routing protocol is what transports the routes.
Also remember BGP is a very deliberate protocol. It pretty much does what you explicitly tell it to. If you don't tell it what to advertise...it wont advertise.
-David
02-22-2023 04:36 PM - edited 02-22-2023 04:47 PM
Hello,
I believe you need to advertise the routes regardless. The import/exports just says this is/is not allowed to be imported/exported into the VRF once it gets to its destination. Similar to MPLS L3VPN, the VRF are redistributed into BGP vpnv4 table (the Route Distinguisher keeps the routes separate). Then it advertises its table to the other iBGP peer on the other side and the import/export tags determine what VRF the routes can go into.
The fundamental underlying routing protocol is what transports the routes.
Also remember BGP is a very deliberate protocol. It pretty much does what you explicitly tell it to. If you don't tell it what to advertise...it wont advertise.
-David
02-22-2023 04:45 PM - last edited on 03-02-2023 01:26 AM by Translator
friend
VRF-to-same-VRF you dont need import/export
VRF-to-differ-VRF you need import/export (VRF leak)
here in your lab you need under bgp ipv4 address
net command for LO subnet,
net 10.10.10.0 mask 255.255.255.0
02-23-2023 03:46 AM
"VRF-to-same-VRF you dont need import/export
VRF-to-differ-VRF you need import/export (VRF leak)"
In just this case?
I may be mistaken, but thought VRF import/export is sometimes needed e.g. when something like MPBGP is being used.
02-23-2023 04:31 AM
I called MPBGP neutral, what I meaning is MPBGP is not VRF-aware and that you can see in commend enter for MPBGP
address family vpnv4 unicast <<-
so if we have
PE1-MPBGP-PE2
PE1 have more than one VRF and PE2 also have more than one VRF
we use MPBGP in between (neutral) but what make MPBGP special ??
MPBGP is special in advertise prefix with pieces of VRF this prefix learn from, this pieces is RT.
and hence we need RT (route-target) import/export in MPBGP.
that All
hope this help @Tuff to full understand the use of RT.
02-22-2023 06:28 PM
Believe you might be confusing RT import/export with redistribution with dynamic routing protocols. RT is sort of like using a route map but with a RD rather than a network prefix.
Have you tried your config without interfaces in the VRF? For such, does R1's loopback IP show in BGP on R2?
02-23-2023 03:17 AM
Hi, thanks for your help. I think i fully understand it now. The import/export is to enable the routes to be put in the correct vrf and the routes must be advertise via the network command or redistributed before the neighbor router can see them.
02-23-2023 04:36 AM
One more note,
As I mention before this between same vrf so no need RT,
Remove route target from vrf and you will see it have no effect.
02-23-2023 10:07 AM
"As I mention before this between same vrf so no need RT,"
In this case, I agree.
However, even with your follow-on, explanation, reply. Those new to VRFs and RD/RT might possibly still be confused.
Whether you need RT import/export is really an "in depends" answer.
Firstly, RD and RT are used to allow different VRF routers to know and use different virtual routing domains, and keep them logically in the same routing domain, across routers.
Possibly a bit of an analogy can be done using L2 VLANs.
Consider the RD much like assigning an VLAN. Instead of providing an identifier for a L2 broadcast domain, it provides an identifier for a L3 routing domain.
Consider a RT export, somewhat, like an VLAN allowed on a Cisco trunk. There's no, analogous L2 VLAN command for a RT import, beyond, perhaps, unless a matching VLAN is defined on the receiving end of a trunk, otherwise unknown VLAN frames received will be dropped.
A case where RTs are not needed, even with multiple VRFs across multiple routers, would be using VRF-Lite (where the VRFs are exchanged across like defined VRF interfaces and/or across trunks (where the VLAN tags map into VRFs).
If RTs are defined for VRF-Lite, noting bad happens.
In the case where there's only one named VRF being used (remember, actually there's always another VRF, i.e. the "global" unnamed "VRF"), as MHM notes, you don't need it. However, I suspect (?) if you're using MPBGP, and you define one router to use RT import/export, and the other doesn't use import/export, you may not be able to exchange routes as one router is looking to use the RT "tag" and the other is not.
If I'm correct that in situations where RT is not going to be used, when truly it's unneeded, possibly best practice would be to define RT import/export anyway, for each VRF (even if only using one), so that you don't accidentally bump into actually needing it.
02-23-2023 10:11 AM
@MHM Cisco World i will try it and see. I just started working for network service provider and they are using huawei devices, so it is kinda confusing as i am more into cisco. But that is the kind of setup their are using to separate each ISP and to import/export routes from respective ISP into their respective VRF which is called vpn-instance on huawei side.
02-23-2023 10:31 AM
Ah, well, that puts things into a different context. Your OP appears as a simple lab setup. What works there, possibly won't work with a service provider, if they are doing more full blown VRF.
That's said, the basics of distinguishing between defining VRFs and passing routes between them, still apply.
Hopefully, my prior posting (assuming I got my facts right) will help a bit too.
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