VRF Lite Configuration on Cisco IOS

In this lesson you will learn about VRFs (Virtual Routing and Forwarding). By default a router uses a single global routing table that contains all the directly connected networks and prefixes that it learned through static or dynamic routing protocols.

VRFs are like VLANs for routers, instead of using a single global routing table we can use multiple virtual routing tables. Each interface of the router is assigned to a different VRF.

In this lesson you will learn about VRFs (Virtual Routing and Forwarding). By default a router uses a single global routing table that contains all the directly connected networks and prefixes that it learned through static or dynamic routing protocols. VRFs are like VLANs for routers, instead of us

VRFs are commonly used for MPLS deployments, when we use VRFs without MPLS then we call it VRF lite. That’s what we will focus on in this lesson. Let’s take a look at an example topology:

ISP Router customer Red BlueIn the topology above we have one ISP router and two customers called “Red” and “Blue”. Each customer has two sites and those are connected to the ISP router. The ISP router has only one global routing table so if we connect everything like the topology above, this is what the routing table will look like:

ISP#show ip route connected
C    192.168.4.0/24 is directly connected, FastEthernet3/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
C    192.168.2.0/24 is directly connected, FastEthernet1/0
C    192.168.3.0/24 is directly connected, FastEthernet2/0

The ISP router has a single global routing table that has all 4 directly connected networks. Let’s use VRFs to change this, I want to create a seperate routing table for customer “Blue” and “Red”. First we have to create these VRFs:

ISP(config)#ip vrf Red
ISP(config-vrf)#exit
ISP(config)#ip vrf Blue
ISP(config-vrf)#exit

Globally we create the VRFs, one for each customer. Our next step is to add the interfaces of the ISP router to the correct VRF. Here’s how:

ISP(config)#interface FastEthernet 0/0
ISP(config-if)#ip vrf forwarding Blue
% Interface FastEthernet0/0 IP address 192.168.1.254 removed due to enabling VRF Blue
ISP(config-if)#ip address 192.168.1.254 255.255.255.0

On the interface level we use the ip vrf forwarding command to assign the interface to the correct VRF. Once you do this , you’ll have to add the IP address again. Let’s configure the remaining interfaces:

ISP(config)#interface FastEthernet 1/0
ISP(config-if)#ip vrf forwarding Red
ISP(config-if)#ip address 192.168.2.254 255.255.255.0

ISP(config)#interface FastEthernet 2/0
ISP(config-if)#ip vrf forwarding Blue
ISP(config-if)#ip address 192.168.3.254 255.255.255.0

ISP(config)#interface FastEthernet 3/0
ISP(config-if)#ip vrf forwarding Red
ISP(config-if)#ip address 192.168.4.254 255.255.255.0

All interfaces are now configured. There’s a useful command you can use to see all the VRFs and their interfaces:

ISP#show ip vrf
  Name                             Default RD          Interfaces
  Blue                                                 Fa0/0
                                                       Fa2/0
  Red                                                  Fa1/0
                                                       Fa3/0

Our VRFs are configured, let’s take a look at the global routing table of the ISP router:

ISP#show ip route connected

The global routing table has no entries, this is because all interfaces were added to a VRF. Let’s check the VRF routing tables:

ISP#show ip route vrf Blue connected
C    192.168.1.0/24 is directly connected, FastEthernet0/0
C    192.168.3.0/24 is directly connected, FastEthernet2/0
ISP#show ip route vrf Red connected
C    192.168.4.0/24 is directly connected, FastEthernet3/0
C    192.168.2.0/24 is directly connected, FastEthernet1/0

We use the show ip route command but you’ll need to specify which VRF you want to look at. As you can see, each VRF has its own routing table with the interfaces that we configured earlier.

If you want to do something on the router like sending a ping then you’ll have to specify which VRF you want to use. By default it will use the global routing table. Here’s an example how to send a ping:

We're Sorry, Full Content Access is for Members Only...

If you like to keep on reading, Become a Member Now! Here is why:

  • Learn any CCNA, CCNP and CCIE R&S Topic. Explained As Simple As Possible.
  • Try for Just $1. The Best Dollar You've Ever Spent on Your Cisco Career!
  • Full Access to our 657 Lessons. More Lessons Added Every Week!
  • Content created by Rene Molenaar (CCIE #41726)

541 Sign Ups in the last 30 days

satisfaction-guaranteed
100% Satisfaction Guaranteed!
You may cancel your monthly membership at any time.
No Questions Asked!

Tags: ,


Forum Replies

  1. René,

    Congrats for share this excellent explanation!!! I’m from Brazil and I don’t have a good English, but I can understand each word, sentence that you used in this article. I never had understood about this subject, maybe because I really didn’t study it with attention and deeply. I’m a beginner Network Admin and when I saw this article in my feed I started to read it and understand it and I’m amazing how you can teach it like this way.

    But I have a doubt where I can’t see in examples above. Using this topology, if tomorrow for any reason Blue and Red make a

    ... Continue reading in our forum

  2. Hi Azm,

    Let me jump in on Cisco VIRL. I can highly recommend to run it in VMWare ESXi, it’s free and saves you the hassle of messing with network interfaces etc. Although I really like VIRL, I had some issues with updates that went wrong and deploying a new OVA template in ESXi is much easier than reinstalling a physical box.

    Look on eBay for an older server that has plenty of RAM and 2x CPUs or something like that.

    I still use an HP proliant DL360 G7 with 96GB of RAM which is great for Cisco VIRL:

    ... Continue reading in our forum

  3. Hi,
    i’m bulding a lab for a POC and need some advise.

    Topology:

                           --------------------------
                           -                              -
                           -        Firewall        -         
                           -                              - 
                           --------------------------
                                         |         int E0/0 (192.168.2.1/24)
                                         |
                                         |
                            --------------------------
                           |     
    ... Continue reading in our forum

  4. Hello,
    thank you for replying.
    I found a way around. Simillar to this: https://www.cisco.com/c/en/us/support/docs/ip/ip-routing/200158-Configure-Route-Leaking-between-Global-a.html
    However this isn’t really a good approach and only a workaround.

    Intial the approach with MP-MGP didn’t come to my attention as wasn’t planning to use BGP in the network.
    What i overlooked is that you don’t need any BGP neighbors !
    I managed to use MP-MGP now, which i ways easiers and my lab is working now.

    Many thanks,
    Oliver

  5. Hello Laz and community,

    I would like to add my comment on this topic. For devices like ASRs or Nexus 3k/5k/7k/9k, they come with a default VRF specifically for management traffic (usually Gig0 interface is assigned to this VRF).

    For Nexus, it’s called “management” and for ASRs it’s called “Mgmt-intf”.
    One more thing, if you try to assign another interface under these VRFs, you will get an error message. The management interface (Gig0) is the only one allowed to be a member of these VRFs

    Regards.

66 more replies! Ask a question or join the discussion by visiting our Community Forum