Strony

Saturday, 10 August 2013

Inter-VRF routing - part 2

This article will cover the topic of routing between vrf instances with use of dynamic routing protocols.

Configuration and testing is based on Cisco devices (IOS).

Previous part of the article can be found here - Inter-VRF routing - part 1

This is the network topology used in the example :
The goal of the scenario is to establish communication bettwen loopback interface of R2 with loopback interface of R3.
On R2 and R3 proper addresses on interfaces were set and RIP was configured (with announcing loopback interfaces into it) - additional configuration on these devices is not needed.
On R1 two vrf instances were created (vr_1 and vr_2), and proper interfaces were assigned to them :
- vr_1 (interface Fa0/0 - towards R2)
- vr_2 (interface Fa1/0 - towards R3)
In vrf instances route distinguishers were set :
- 65001:1 in vr_1
- 65001:2 in vr_2

Quick note about route distinguisher:
VRF instances allow to have overlaping subnets present on the router (for example 10.1.1.0/24 network). Let's assume - that we have 3 such subnets, assigned to three different organisations. Route distinguisher is used to differentiate - to which organization particular route belong.The real purpose of route distinguisher's is better visible in more complex scenarios - where routes are exchanged between other devices (PE routers - with use of BGP).

Base configuration of R1 :
!
ip vrf vr_1
rd 65001:1
!
ip vrf vr_2
rd 65001:2
!
interface FastEthernet0/0
ip vrf forwarding vr_1
ip address 10.1.2.1 255.255.255.0
!
interface FastEthernet1/0
ip vrf forwarding vr_2
ip address 10.1.3.1 255.255.255.0

At this moment R1 and R2 loopback interfaces are unable to communicate, to allow this - additonal configuration is needed on R1. Let's divide the process into smaller steps:

1.Configuration of RIP (to have routes from R2 and R3 in proper vrf instances on R1).

2.Configuration of BGP and redistribution of RIP routes from vrf instances into it.

3.Usage of the route-target import and export functionality to "transfer" routes from BGP into routing tables of proper vrf instances (after this step, routes from vrf instances vr_1 and vr_2 are "exchanged" between them).

4. Redistribution of BGP routes from vrf instances into RIP (to advertise proper routes to R2 and R3).

Step 1 -  Configuration of RIP

Added configuration to R1: 
router rip
!
address-family ipv4 vrf vr_2
network 10.0.0.0
no auto-summary
exit-address-family
!
address-family ipv4 vrf vr_1
network 10.0.0.0
no auto-summary
exit-address-family
!

Routing table of R1 after configuring RIP :
R1#show ip route vrf vr_1 rip
R 192.168.2.0/24 [120/1] via 10.1.2.2, 00:00:20, FastEthernet0/0
R1#show ip route vrf vr_2 rip
R 192.168.3.0/24 [120/1] via 10.1.3.3, 00:00:06, FastEthernet1/0

At this moment - in each vrf instance on R1, routes to proper loopback interfaces are present :
- in vr_1 to the 192.168.2.0 network (loopback of R2)
- in vr_2 to the 192.168.3.0 network (loopback of R3)


Step 2 - Configuration of BGP and redistribution of RIP routes into it

Added configuration to R1:
router bgp 65001
no synchronization
bgp log-neighbor-changes
no auto-summary
!
address-family ipv4 vrf vr_2
redistribute rip
no synchronization
exit-address-family
!
address-family ipv4 vrf vr_1
redistribute rip
no synchronization
exit-address-family

Information from BGP - after redistributing RIP into it:

R1#show ip bgp vpnv4 all
BGP table version is 17, local router ID is 172.16.4.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network          Next Hop            Metric LocPrf Weight Path
Route Distinguisher: 65001:1 (default for vrf vr_1)
*> 10.1.2.0/24      0.0.0.0                  0         32768 ?
*> 192.168.2.0      10.1.2.2                 1         32768 ?
Route Distinguisher: 65001:2 (default for vrf vr_2)
*> 10.1.3.0/24      0.0.0.0                  0         32768 ?
*> 192.168.3.0      10.1.3.3                 1         32768 ?


Step 3 - Usage of the route-target import and export functionality

Added configuration to R1:
ip vrf vr_1
 route-target export 65001:1
 route-target import 65001:2
!
ip vrf vr_2
 route-target export 65001:2
 route-target import 65001:1

At this point - proper routes from BGP should be present in the vrf instances on R1:

R1#show ip route vrf vr_1 bgp
     10.0.0.0/24 is subnetted, 2 subnets
B       10.1.3.0 is directly connected, 00:02:46, FastEthernet1/0
B    192.168.3.0/24 [20/1] via 10.1.3.3 (vr_2), 00:02:46, FastEthernet1/0
R1#show ip route vrf vr_2 bgp
     10.0.0.0/24 is subnetted, 2 subnets
B       10.1.2.0 is directly connected, 00:02:50, FastEthernet0/0
B    192.168.2.0/24 [20/1] via 10.1.2.2 (vr_1), 00:02:50, FastEthernet0/0

At this moment in the routing table of vrf instance vr_1 (connected with router R2) - route to the network 192.168.3.0/24 (loopback interface of R3) is present.
Additionally in the vrf instance vr_2 (connected with router R3) - route to the 192.168.2.0/24 network is visible.
The routes were "exchanged" between routing tables of vrf instances.

Step 4 - Redistribution of BGP routes from vrf instances into RIP

Added configuration to R1:
router rip
 !
 address-family ipv4 vrf vr_2
 redistribute bgp 65001 metric 2
 !
 address-family ipv4 vrf vr_1
 redistribute bgp 65001 metric 2

Routing table from R2 and R3 after configuration :
R2#show ip route rip
     10.0.0.0/24 is subnetted, 2 subnets
R       10.1.3.0 [120/2] via 10.1.2.1, 00:00:10, FastEthernet0/0
R    192.168.3.0/24 [120/2] via 10.1.2.1, 00:00:10, FastEthernet0/0

R3#show ip route rip
     10.0.0.0/24 is subnetted, 2 subnets
R       10.1.2.0 [120/2] via 10.1.3.1, 00:00:04, FastEthernet0/0
R    192.168.2.0/24 [120/2] via 10.1.3.1, 00:00:04, FastEthernet0/0

At this moment  R2 and R3 know how to reach each other networks.

Verfication

Ping was sent from R2 loopback interface to R3 loopback interface :
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 = 28/48/64 ms

The communication between loopback interface of R2 and loopback interface of R3 is successfull.

No comments:

Post a Comment