Let's assume we have a switch connected to 2 hosts through 2 VLANs. And the switch is connected to a router (1) which handles VRF. enter image description here

Let's assume Router 1 and Router 2 implement two VRF: VRF_Red and VRF_blue. The red computer sends a ping packet for instace to Router 2. How does the router 1 select the VRF table in this case ? Based on IP source address?

Also through 1 physical interface (with dot1q VLAN) between the switch and the router, can the router receive and assign packets from the switch to the corresponding VRF then forward it accordingly?

Usually speaking, in case static routing to router 1 is considered, only 1 default gateway is enough or since there are 2 VRFs 2 default gateway is required? Would the default gateway of the computer red and computer blue be the same? The answer is no so I understand.

Thank you in advance.

EDITED the image and the bold text.


1 Answer 1


The most typical for PE-to-CE ports (Provider Edge to Customer Edge) is to put a whole layer-3 interface (VLAN or routed port) into a given VRF.

For connections inside your backbone, this is a little more complex. I see you've used the vrf-lite tag on your post, indicating your PE device probably does not support MPLS L3VPNs. In these situations, you're right, it is possible to use 802.1Q VLANs to maintain separation of traffic between different VRFs and trunk that traffic to other vrf-lite devices or to full-featured MPLS L3VPN routers.

If you were to modify the diagram in your post, to carry both red & blue lines between the leftmost switch and Router 1, that would accurately describe the concept.

If you're using VRF-lite on the leftmost switch, it would generally be the layer-3 gateway for attached subnets within the VRFs. It might use a routing protocol, such as BGP, or OSPF, to exchange routes with Router 1; but that's not a required feature of the VRF-lite concept. It could be all static routing; that would require configuring routes on Router 1 to point to the switch for the switch's attached subnets.

  • Thank for your reply. I have updated the sceme accordingly. Is this okay. If i understand correctly, the interface 1/0.1 on router 1 will have an ip adress (let's say which will be the default gateway of the computer red. Similarly, the interface 1/0.2 on router with IP adress for instance?
    – huseyin39
    Sep 29, 2020 at 21:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.