Watch on Instagram

Network Bytes · Episode 86 · CCNA 1.12

"VRFs: one router, separate routing tables"

A router normally keeps one routing table, so two networks with the same addresses would clash. A VRF (virtual routing and forwarding) gives one router separate routing tables, and each interface is put into one of them, so overlapping addresses can live side by side.

Posted · About a 1 minute watch, 4 minute read · Take the quiz

The problem: one table, two identical networks

A router decides where to send a packet by looking up the destination in its routing table. Normally there is just one table, the global routing table, shared by every interface.

Now picture two customers, A and B, plugged into the same router. Both use the private subnet 10.1.1.0/24. In a single table, the router would see two routes to 10.1.1.0/24 pointing at different ports. A packet for 10.1.1.5 could belong to either customer, so the two networks clash.

A VRF: a separate table per customer

A VRF creates a separate routing and forwarding table inside the same router. Think of one office building with a separate mailroom for each company: the building is shared, but each company's mail is sorted only in its own room.

  • VRF A has its own table with 10.1.1.0/24 pointing at customer A's port.
  • VRF B has its own table with 10.1.1.0/24 pointing at customer B's port.
  • The router's normal global table is still there for any interface not placed in a VRF.

Routes in one VRF are not used for traffic in another, so the same addresses can exist in both, kept apart.

Putting interfaces into a VRF

You don't put packets into a VRF; you put interfaces (or subinterfaces) into one. Each interface belongs either to the global table or to exactly one VRF. Traffic arriving on that interface is routed using that VRF's table only.

On Cisco IOS it looks like this:

`` vrf definition A address-family ipv4 ! interface g0/1 vrf forwarding A ip address 10.1.1.1 255.255.255.0 ``

Two details catch people out. Older IOS versions use ip vrf A and ip vrf forwarding A instead. And putting an interface into a VRF removes its IP address, so you have to enter the address again afterwards. To see one VRF's table, use show ip route vrf A; plain show ip route shows only the global table.

VRF-lite and service providers

Using VRFs on a single router like this, without MPLS, is called VRF-lite. It's handy for keeping guest Wi-Fi, a management network or different departments apart on shared hardware. Service providers combine VRFs with MPLS VPNs to carry many customers' overlapping networks across their whole backbone, which goes beyond CCNA.

Try it yourself

Look at the routing table on your own computer: route print on Windows, netstat -rn on macOS, or ip route on Linux. That's one table, like a router's global table. On Linux, ip vrf show lists any VRF devices; on most home machines the list is empty, because everything uses the one main table. If you have Cisco lab gear or a lab simulator that supports VRFs, create two VRFs, give two interfaces the same 10.1.1.0/24 subnet in different VRFs, and compare show ip route vrf A with show ip route vrf B.

Good to know

  • CCNA 1.12 lists VRFs with server virtualization and containers under virtualization fundamentals (EP78 covers virtual machines).
  • A VRF instance is a separate routing and forwarding table on one router; each interface (or subinterface) belongs to the global table or to one VRF, and routes in one VRF are not used for traffic in another, so overlapping addresses can coexist.
  • Using VRFs on one router without MPLS is called VRF-lite; service providers combine VRFs with MPLS VPNs (beyond CCNA scope).
  • On Cisco IOS, vrf definition <name> (or the older ip vrf <name>) creates a VRF and vrf forwarding <name> (or ip vrf forwarding) assigns an interface, which removes the interface's IP address so it must be re-entered; show ip route vrf <name> shows a VRF's table.
  • Routes can be deliberately leaked between VRFs, which the video skips.
  • "Separate mailrooms" is an analogy, and 10.1.1.0/24 is a private example subnet.

For CCNA learners

CCNA exam topic 1.12 is explain virtualization fundamentals, and it names VRFs. Know that a VRF is a separate routing table on one router, that interfaces are assigned to VRFs, and that this lets overlapping IP addresses coexist.

Answer to the comment question

4. Each VRF keeps its own routing table, so three VRFs means three tables, and the router still keeps its normal global table for interfaces that aren't in any VRF: 3 + 1 = 4.

Test your knowledge

Quick quiz: "VRFs: one router, separate routing tables"

4 multiple-choice questions. Pick one answer for each, then check how you did.

1Why can't two customers using 10.1.1.0/24 share one ordinary routing table?
2What does a VRF give a router?
3How does traffic end up using a particular VRF's table?
4On Cisco IOS, what happens when you enter vrf forwarding A on an interface that already has an IP address?

Sources

Video transcript

Can one router serve two customers who use the exact same IP addresses?

Normally a router has one routing table, so two networks both using 10.1.1.0 would clash.

A VRF, virtual routing and forwarding, splits one router into separate virtual routers, each with its own routing table. Like one building with a separate mailroom for each company.

You put each interface into a VRF. Customer A's ports use table A. Customer B's ports use table B.

Traffic in one VRF can't see the other, so the same addresses can live side by side, kept apart.

A router has three VRFs, plus its normal global table. How many routing tables does it keep? Comment your answer below!

That's your byte.

More from Network Bytes

All Network Bytes lessons