Strony

Friday, 2 August 2013

Inter-VRF routing - part 1


In this article two scenarios will be described:

1. Routing between one vrf instance and global routing table.
2. Routing between two vrf instances.
 
Configuration is based on Cisco devices (IOS).

Only static routing will be used in both examples.
Note to the second scenario (routing between vrf instances) :  it may not work on all devices, advisible solution is to use BGP and import functionality of route-target (part 2 of the article covers this scenario - Inter-VRF routing - part 2 )

Basic information about VRF can be found in this post : VRF - Basics

This is the network topology :



On router R1 two vrf instances were configured and proper interfaces were assigned to them:
- vrf instance "vr_2" (interface Fa0/1 – towards router R2)
- vrf instance "vr_3" (interface Fa0/2 – towards router R3)

Interface Fa0/3 on R1 is connected with router R4 and is positioned in global routing table.
Routers R2, R3 and R4 have addresses on proper interfaces configured and default routes added :

R2 – ip route 0.0.0.0 0.0.0.0 10.1.2.1
R3 – ip route 0.0.0.0 0.0.0.0 10.1.3.1
R4 – ip route 0.0.0.0 0.0.0.0 172.16.4.1


Configuration of R1 :

ip vrf vr_2
ip vrf vr_3

interface FastEthernet0/1
 no switchport
 ip vrf forwarding vr_2
 ip address 10.1.2.1 255.255.255.0

interface FastEthernet0/2
 no switchport
 ip vrf forwarding vr_3
 ip address 10.1.3.1 255.255.255.0

interface FastEthernet0/3
 no switchport
 ip address 172.16.4.1 255.255.255.0


1. Routing between one vrf instance and global routing table

The goal is to establish communication between loopback 0 interface from R2 with loopback 0 interface from R4.

To achieve this objective two steps are required on R1 :

a) add static route in the vrf instance vr_2 - to the 192.168.4.0/24 network via int Fa0/3 which is in the global routing table (keyword global at the end of the command)
Command :
ip route vrf vr_2 192.168.4.0 255.255.255.0 FastEthernet0/3 172.16.4.4 global

b) add static route in the global routing table to the 192.168.2.0/24 network via int Fa0/1 (int Fa0/1 is assigned to vrf instance vr_2).
Command:
ip route 192.168.2.0 255.255.255.0 FastEthernet0/1 10.1.2.2

Global routing table and routing table from vrf instance vr_2 after adding routes :

R1#show ip route static
S    192.168.2.0/24 [1/0] via 10.1.2.2, FastEthernet0/1
R1#show ip route vrf vr_2 static
S    192.168.4.0/24 [1/0] via 172.16.4.4, FastEthernet0/3 

To verify settings – ping from R2 loopback 0 to R4 loopback 0 was sent :

R2#ping 192.168.4.4 source 192.168.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.4.4, timeout is 2 seconds:
Packet sent with a source address of 192.168.2.2
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/4 ms

2. Routing between two vrf instances

The goal of this scenario is to establish communication between loopback 0 interface from R2 with loopback 0 interface from R3.
 
To achieve this objective two steps are required on R1 (configuration from scenario "Routing between global routing table and vrf instance" is not needed and was removed from configuration) :
 
a) add static route in the vrf instance vr_2 - to the 192.168.3.0/24 network via int Fa0/2 (int Fa0/2 is assigned to the vrf instance vr_3)
Command:
ip route vrf vr_2 192.168.3.0 255.255.255.0 FastEthernet0/2 10.1.3.3

b) add static route in the vrf instance vr_3 - to the 192.168.2.0/24 network via int Fa0/1 (int Fa0/1 is assigned to the vrf instance vr_2)
Command:
ip route vrf vr_3 192.168.2.0 255.255.255.0 FastEthernet0/1 10.1.2.2
 
Routing table from vrf instance vr_2 and vr_3 after adding routes :

R1#show ip route vrf vr_2 static
S    192.168.3.0/24 [1/0] via 10.1.3.3, FastEthernet0/2
R1#show ip route vrf vr_3 static
S    192.168.2.0/24 [1/0] via 10.1.2.2, FastEthernet0/1

To verify settings – ping from R2 loopback 0 to R3 loopback 0 was sent :

R2#ping 192.168.3.3 source 192.168.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.3, timeout is 2 seconds:
Packet sent with a source address of 192.168.2.2
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/4 ms


No comments:

Post a Comment