Configure an IPv4 Static Interface Route Across VRFs

You can configure an IPv4 static interface route from one VRF to an IPv4 interface in a different VRF.

Before you begin

Ensure that VRFs in the route configuration are valid VRFs.

About this task

By configuring static routes between VRFs, you can connect one VRF to a host that is directly connected to a port in a different VRF. You can do this by configuring a static route to the interface that is directly connected to the device with the IP address you want to reach.

Consider VRF A and VRF B with the following characteristics. The steps in this procedure create an interface route between these two sample VRFs.

VRF A VRF B
Route Distinguisher 1:1 2:2
Interface Ethernet port 1/1 Ethernet port 1/2
IP Address 10.0.0.1/24 10.0.0.1/24

Procedure

  1. Configure VRF A.
    1. Define a route descriptor for VRF A in VRF configuration mode.
      device# configure terminal
      device(config)# vrf A
      device(config-vrf-A)# rd 1:1
      
      
    2. Configure VRF A to use IPv4 addressing.
      
      device(config-vrf-A)# address-family ipv4 unicast
      device(config-vrf-A-ipv4-unicast)# exit
      device(config-vrf-A)# exit
      
    3. Configure a device interface to forward traffic over VRF A.
      device(config)# interface ethernet 1/1
      device(config-if-e10000-1/1)# vrf forwarding A
      
    4. Assign an IP address to the interface.
      
      device(config-if-e10000-1/1)# ip address 10.0.0.1/24
      device(config-if-e10000-1/1)# exit
      device(config)#
      
  2. Configure VRF B.
    1. Define a route descriptor for VRF B in VRF configuration mode.
      device(config)# vrf b
      device(config-vrf-b)# rd 2:2
      
    2. Configure VRF B to use IPv4 addressing.
      device(config-vrf-b)# address-family ipv4 unicast
      device(config-vrf-b-ipv4-unicast)# exit
      device(config-vrf-b)# exit
      
    3. Configure an interface to forward traffic from VRF B.
      device(config)# interface ethernet 1/2
      device(config-if-e10000-1/2)# vrf forwarding B
      
    4. Assign an IP address to the interface.
      device(config-if-e10000-1/2)# ip address 10.0.0.1/24
      device(config-if-e10000-1/2)# exit
      
  3. Configure an IP static route for VRF A that directs traffic to the port that forwards traffic from VRF B.
    device(config)# vrf a
    device(config-vrf-A)# ip route 10.0.0.1/24 ethernet 1/2
    

Example

The following is the complete process for configuring VRF A to forward traffic over port 1/1 and VRF B to forward traffic over port 1/2. Port 1/2 is configured with an IP address of 10.0.0.1/24.The last step configures a static route on VRF A to use port 1/2 as the next-hop to network destinations beginning with 10.0.0.1/24, thereby connecting VRF A to VRF B.

device# configure terminal
device(config)# vrf A
device(config-vrf-A)# rd 1:1
device(config-vrf-A)# address-family ipv4 unicast
device(config-vrf-A-ipv4-unicast)# exit
device(config-vrf-A)# exit
device(config)# interface ethernet 1/1
device(config-if-e10000-1/1)# vrf forwarding A
device(config-if-e10000-1/1)# ip address 10.0.0.1/24
device(config-if-e10000-1/1)# exit
device(config)# vrf B
device(config-vrf-B)# rd 2:2
device(config-vrf-B)# address-family ipv4 unicast
device(config-vrf-B-ipv4u)# exit
device(config-vrf-B)# exit
device(config)# interface ethernet 1/2
device(config-if-e10000-1/2)# vrf forwarding B
device(config-if-e10000-1/2)# ip address 10.0.0.1/24
device(config-if-e10000-1/2)# exit
device(config)# vrf a
device(config-vrf-A)# ip route 10.0.0.1/24 ethernet 1/2