Cisco Virtual Routing and Forwarding (VRF)
Cisco Virtual Routing and Forwarding (VRF)
Cisco Virtual Routing and Forwarding (VRF)
What is VRF?
VRF is the abbreviation of Virtual Routing and Forwarding. Basically, VRF is a technology
with which we can create separate virtual routers on a physical router. With these separate virtual
routers, we can use router interfaces, routing and forwarding tables isolated with VRFs. The
network traffic in a VRF is not forwarded to another VRF. In other words, forwarding process is
done only between the interfaces on the same VRF. In this lesson, we will focus on Cisco Virtual
Routing and Forwarding.
As you know, service providers give services to different networks. And these different networks
use overlapping IP addressing inside their network. So, how a service provider manage this without
a conflict? Service providers uses VRF for multiple routing instances. By doing this, they connect
customer locations without any conflict. From the point of customer view, their locations are
connected to the ports of a router.
VRFs are similar to VLANs used in switches at layer 2 of the OSI Reference Model. But VRF
technology works at Layer 3. As you know, with VLANs, we can create multiple virtual switches
in a physical switch. With VRFs, we can create multiple routers in a physical router.
By default, a physical router has one global routing table and works as one router. This means that
all the router interfaces and routing, forwarding tables are belong to Global VRF. But, with
multiple VRFs, we can separate a router into multiple routers. Ans this is the answer of what is
VRF question.
As you can see above, there is one physical router in the above Service Provider topology. But
when we use VRF, we create two virtual routers with two VRFs. Each of these VRF Routing tables
are separate from the other.
Benefits of VRFs
There are various benefits of VRFs (Virtual Routing and Forwarding). Below, you can find these
VRF benefits.
With VRFs, we can create multiple virtual routers in a single physical router with
isolated routing and forwarding.
With VRFs, we can use overlapping IP addresses on created separate virtual routers.
With separate and small routing tables, VRFs provide easy troubleshooting.
Useful for MP-BGP and MPLS deployments.
You can also check Cisco Packet Tracer Labs Course!
As you can see on the topology, there is one ISP router and there are three customers. Each
customer has two branches and they are using the same IP address range for their interfaces.
Normally, it is not possible to use same IP address on the interfaces of a router. But with VRF, this
will be possible. Let’s see how it is possible.
For our Cisco VRF Lite Configuration example, we will follow the below steps:
Creating VRFs
Setting IPv4 & IPv6 Address Families
Assigning interfaces to VRFs
Enabling Routing For VRFs
VRF Verification
Here, we will do Cisco Virtual Routing and Forwarding configuration on ISP router. So,
customer routers will not know what is going on. They will think that, they are connected to a
specific router which connects them to the other branch.
Now, let’s configure the routers on the topology for our Cisco Virtual Routing and Forwarding,
VRF Lite Example.
You can also download Cisco Router and Switch Configuration Labs!
Creating VRFs
Our first step on this example is creating VRFs. We can create VRFs with two different commands.
One of them is old “ip vrf vrf-name” command and the other is new “vrf definition vrf-name”
command. Below, we will show both of them.
CustomerX
CustomerY
CustomerZ
Firstly, we will use use the new version of VRF create command like below:
ISP(config-vrf)# end
Secondly, let’s use the old one that we can still use.
ISP# configure terminal
ISP(config-vrf)# end
After creating VRFs on Service Provider router, let’s verify them with “show ip vrf” command.
ISP(config-vrf-af)# exit
ISP(config-vrf-af)# exit
As you can see above, VRF creation will remove the interface IP address. So, we should
reconfigure the interface IP address.
ISP(config-if)# no shutdown
ISP(config-if)# exit
ISP(config-if)# no shutdown
ISP(config-if)# end
ISP(config-if)# end
ISP(config-if)# end
ISP(config-if)# end
ISP(config-if)# end
To configure default route for VRF CustomerX, we will use the below command:
To enable OSPFv2 for VRF CustomerX, we will use the below vrf command:
To enable EIGRP and to assign CustomerX VRF to IPv4 unicast address family for AS 100
To enable BGP for AS 100 and to assign CustomerX VRF to IPv4 unicast address family.
VRF Verification
Now, let’s use “show vrf” and “show vrf detail vrf-name” commands to see the interfaces under
the related VRFs.
And, we can check the interface ip addresses with “show ip interface brief” command. As you can
see, different interfaces can use same ip addresses with VRFs. Normally, this is not possible in a
router.
And can check routing table with “show ip route” command. This is global routing table, which
can be called also as Global VRF. Global routing table is empty because we do not have any
interfaces using this global routing table.
We can check each VRF’s routing table with “show ip route vrf vrf-name” command.
To verify the connection between two branches of the customers, let’s use “ping vrf vrf-name
interface-ip-address” command. Here, when we ping the same address with different vrf names,
we will ping the related vrf interface.