Skip to content

VRF

VRF (Virtual Routing and Forwarding) enables network virtualization by creating isolated routing and forwarding instances within a single physical device. It supports MPLS Layer 3 VPNs, multi-tenancy, and network segmentation through separate routing tables, forwarding tables, and interfaces for each VRF instance. VRF provides comprehensive control over route import/export policies using route targets, route distinguishers for unique route identification, route replication between VRFs for selective route leaking, supports both IPv4 and IPv6 address families with granular policy control, includes EVPN integration through VNID (VXLAN Network Identifier) for automated route-target generation and stitching, and supports Multicast Distribution Tree (MDT) configuration for Tenant Routed Multicast (TRM) deployments.

Diagram
NameTypeConstraintMandatoryDefault Value
vrfsList[vrfs]No

NameTypeConstraintMandatoryDefault Value
nameStringYes
descriptionStringNo
route_distinguisherStringNo
rd_autoBooleantrue, falseNo
address_family_ipv4Class[address_family_ipv4]No
address_family_ipv6Class[address_family_ipv6]No
vpn_idStringRegex: ^[0-9a-fA-F]{1,6}:[0-9a-fA-F]{1,8}$No
vnidList[vnid]No

address_family_ipv4 (iosxe.devices.configuration.vrfs)

Section titled “address_family_ipv4 (iosxe.devices.configuration.vrfs)”
NameTypeConstraintMandatoryDefault Value
enableBooleantrue, falseNo
import_route_targetsListStringNo
import_route_targets_stitchingListStringNo
export_route_targetsListStringNo
export_route_targets_stitchingListStringNo
route_replicateList[route_replicate]No
import_mapStringNo
export_mapStringNo
mdtClass[mdt]No

address_family_ipv6 (iosxe.devices.configuration.vrfs)

Section titled “address_family_ipv6 (iosxe.devices.configuration.vrfs)”
NameTypeConstraintMandatoryDefault Value
enableBooleantrue, falseNo
import_route_targetsListStringNo
import_route_targets_stitchingListStringNo
export_route_targetsListStringNo
export_route_targets_stitchingListStringNo
import_mapStringNo
export_mapStringNo

NameTypeConstraintMandatoryDefault Value
vnid_valueIntegermin: 1, max: 2147483647Yes
evpn_instance_vniList[evpn_instance_vni]No

route_replicate (iosxe.devices.configuration.vrfs.address_family_ipv4)

Section titled “route_replicate (iosxe.devices.configuration.vrfs.address_family_ipv4)”
NameTypeConstraintMandatoryDefault Value
nameStringYes
route_mapStringNo

mdt (iosxe.devices.configuration.vrfs.address_family_ipv4)

Section titled “mdt (iosxe.devices.configuration.vrfs.address_family_ipv4)”
NameTypeConstraintMandatoryDefault Value
default_addressIPNo
auto_discovery_vxlanBooleantrue, falseNo
auto_discovery_vxlan_inter_asBooleantrue, falseNo
auto_discovery_interworking_vxlan_pimBooleantrue, falseNo
auto_discovery_interworking_vxlan_pim_inter_asBooleantrue, falseNo
overlay_use_bgpBooleantrue, falseNo
overlay_use_bgp_spt_onlyBooleantrue, falseNo
data_multicastList[data_multicast]No
data_thresholdIntegermin: 1, max: 4294967No

evpn_instance_vni (iosxe.devices.configuration.vrfs.vnid)

Section titled “evpn_instance_vni (iosxe.devices.configuration.vrfs.vnid)”
NameTypeConstraintMandatoryDefault Value
vni_numIntegermin: 4096, max: 16777215Yes
core_vlanIntegermin: 1, max: 4094No

data_multicast (iosxe.devices.configuration.vrfs.address_family_ipv4.mdt)

Section titled “data_multicast (iosxe.devices.configuration.vrfs.address_family_ipv4.mdt)”
NameTypeConstraintMandatoryDefault Value
addressIPYes
wildcardIPYes
access_listStringNo

By segmenting the network into multiple VRFs, you achieve traffic isolation, multi-tenancy, and efficient resource utilization, making VRF essential for service providers and enterprises requiring routing separation. The VNID feature enables seamless EVPN integration for VXLAN-based network overlays.

Key Components:

  • VRF Name (name): The unique identifier for the VRF instance.

  • Description (description): A text description for the VRF, useful for documentation and operational clarity.

  • Route Distinguisher (route_distinguisher): Uniquely identifies routes within the MPLS VPN domain, preventing overlap.

  • Address Families (address_family_ipv4, address_family_ipv6): Enable IPv4 and/or IPv6 routing within the VRF, each containing route target configuration and route replication settings.

  • Route Replication (route_replicate): Enables selective route leaking between VRFs by replicating routes from one VRF to another, with optional route-map filtering for granular control over which routes are leaked.

  • Import/Export Route Maps (import_map, export_map): Apply route-map based filtering policies for VRF route import and export operations, providing fine-grained control over which routes are imported into or exported from the VRF.

  • VPN ID (vpn_id): Identifies the VPN for interoperability and management.

  • VNID Configuration (vnid): Configures VXLAN Network Identifier for EVPN integration, enabling automatic route-target generation and stitching for VXLAN-based overlay networks.

  • MDT Configuration (mdt): Configures Multicast Distribution Tree for Tenant Routed Multicast (TRM) within the IPv4 address family. Supports default group address, auto-discovery for VxLAN and VxLAN-PIM interworking, BGP overlay signaling, data multicast group ranges with wildcard masks, and switching thresholds.

  • Interface Association (interface): Associates physical or logical interfaces with the VRF for traffic isolation.

Key Parameters Briefly Explained:

  • name: Sets the VRF instance name.
  • description: Adds a description to the VRF.
  • route_distinguisher: Configures the unique route identifier.
  • rd_auto: Enables automatic route distinguisher assignment.
  • address_family_ipv4, address_family_ipv6: Enable IPv4/IPv6 address families with route target configuration and route replication.
  • route_replicate: Configures selective route leaking from other VRFs with optional route-map filtering.
  • import_map, export_map: Apply route-map based filtering for VRF route import/export operations.
  • vpn_id: Sets the VPN identifier.
  • vnid: Configures VXLAN Network Identifier with optional EVPN instance for automatic route-target generation.
  • mdt: Configures MDT for TRM with default group, auto-discovery, overlay signaling, data group ranges, and threshold.
  • interface: Associates interfaces with the VRF.

You can use these VRF parameters to define isolated routing environments on your network device. Customize the name, route distinguisher, route targets, route replication settings, VNID configuration, MDT settings, and interface associations to fit your network’s segmentation and multi-tenancy needs. Adjusting these parameters lets you tailor traffic isolation, selective route leaking, routing policies, EVPN integration, and multicast distribution for different network domains.

ip vrf definition VRF-PROD
description Production VRF
rd 200:1
route-target export 200:10
route-target export 300:10
route-target import 200:10
route-target import 300:10
vnid 50001
address-family ipv4
route-target import 200:11 stitching
route-target export 300:11
route-replicate from vrf global unicast all route-map RM-GLOBAL
route-replicate from vrf VRF-GUEST unicast all
import map IMPORT-MAP-1
export map EXPORT-MAP-1
exit-address-family
address-family ipv6
route-target import 200:13
route-target export 300:13 stitching
import map IMPORT-MAP-1
export map EXPORT-MAP-1
exit-address-family
!
interface GigabitEthernet0/1
ip vrf forwarding VRF-PROD
ip address 10.0.0.1 255.255.255.0

The following YAML code sets up a VRF instance on an IOS-XE device, specifying its name, description, route distinguisher, route targets for import and export, route replication for selective route leaking, VNID for EVPN integration, and address family configurations for both IPv4 and IPv6.

iosxe:
devices:
- name: Device1
configuration:
vrfs:
- name: "VRF-PROD"
description: "Production VRF"
route_distinguisher: "200:1"
address_family_ipv4:
enable: true
import_route_targets: ["200:11"]
import_route_targets_stitching: ["200:12"]
export_route_targets: ["300:11"]
export_route_targets_stitching: ["300:12"]
route_replicate:
- name: global
route_map: RM-GLOBAL
- name: VRF-GUEST
import_map: IMPORT-MAP-1
export_map: EXPORT-MAP-1
address_family_ipv6:
enable: true
import_route_targets: ["200:13"]
import_route_targets_stitching: ["200:14"]
export_route_targets: ["300:13"]
export_route_targets_stitching: ["300:14"]
import_map: IMPORT-MAP-1
export_map: EXPORT-MAP-1
vpn_id: "36B:1234"
vnid:
- vnid_value: 50001
evpn_instance_vni:
- vni_num: 60001
iosxe:
devices:
- name: Router1
configuration:
vrfs:
- name: VRF1
vnid:
- vnid_value: 10001
evpn_instance_vni:
- vni_num: 20001
iosxe:
devices:
- name: Switch1
configuration:
vrfs:
- name: VRF1
vnid:
- vnid_value: 10100
evpn_instance_vni:
- vni_num: 20100
core_vlan: 3100 # Switch-only: maps VNI to core VLAN

Platform Notes:

  • Router platforms (Cat8k): Do NOT include core_vlan - configuration will be rejected
  • Switch platforms (Cat9k): core_vlan is optional - required only for explicit VLAN-to-VNI mapping
  • Core-VLANs should use high range (3000+) to avoid conflicts with data VLANs

MDT Configuration (Tenant Routed Multicast)

Section titled “MDT Configuration (Tenant Routed Multicast)”

MDT enables multicast forwarding within VRFs for TRM deployments. The mdt block under address_family_ipv4 configures the default multicast group, auto-discovery mode, overlay signaling, and data group ranges.

ip vrf definition TRM_VRF
rd 65000:100
address-family ipv4
mdt default 239.1.1.1
mdt auto-discovery vxlan
mdt auto-discovery vxlan inter-as
mdt data 239.1.2.0 0.0.0.255
mdt data threshold 50
exit-address-family

Router Platform (VxLAN auto-discovery not available)

Section titled “Router Platform (VxLAN auto-discovery not available)”
iosxe:
devices:
- name: Router1
configuration:
vrfs:
- name: TRM_VRF
route_distinguisher: "65000:100"
address_family_ipv4:
enable: true
mdt:
default_address: 239.1.1.1
data_threshold: 50
data_multicast:
- address: 239.1.2.0
wildcard: 0.0.0.255

Switch Platform (With VxLAN auto-discovery)

Section titled “Switch Platform (With VxLAN auto-discovery)”
iosxe:
devices:
- name: Switch1
configuration:
vrfs:
- name: TRM_VRF
route_distinguisher: "65000:100"
address_family_ipv4:
enable: true
mdt:
default_address: 239.1.1.1
auto_discovery_vxlan: true
auto_discovery_vxlan_inter_as: true
data_threshold: 50
data_multicast:
- address: 239.1.2.0
wildcard: 0.0.0.255
- address: 239.1.3.0
wildcard: 0.0.0.255
access_list: MDT-ACL

The following YAML establishes a VRF on the device and enables rd-auto under the VRF.

iosxe:
devices:
- name: Device1
configuration:
vrfs:
- name: "VRF-PROD"
description: "Production VRF"
rd_auto: true

VRF (Virtual Routing and Forwarding) enables network virtualization by creating isolated routing and forwarding instances within a single physical device. It supports MPLS Layer 3 VPNs, multi-tenancy, and network segmentation through separate routing tables, forwarding tables, and interfaces for each VRF instance. VRF provides comprehensive control over route import/export policies using route targets, route distinguishers for unique route identification, route replication between VRFs for selective route leaking, and supports both IPv4 and IPv6 address families with granular policy control.

Diagram
NameTypeConstraintMandatoryDefault Value
vrfsList[vrfs]No

NameTypeConstraintMandatoryDefault Value
nameStringYes
descriptionStringNo
route_distinguisherStringNo
address_family_ipv4Class[address_family_ipv4]No
address_family_ipv6Class[address_family_ipv6]No
vpn_idStringRegex: ^[0-9a-fA-F]{1,6}:[0-9a-fA-F]{1,8}$No

address_family_ipv4 (iosxe.devices.configuration.vrfs)

Section titled “address_family_ipv4 (iosxe.devices.configuration.vrfs)”
NameTypeConstraintMandatoryDefault Value
enableBooleantrue, falseNo
import_route_targetsListStringNo
import_route_targets_stitchingListStringNo
export_route_targetsListStringNo
export_route_targets_stitchingListStringNo
route_replicateList[route_replicate]No

address_family_ipv6 (iosxe.devices.configuration.vrfs)

Section titled “address_family_ipv6 (iosxe.devices.configuration.vrfs)”
NameTypeConstraintMandatoryDefault Value
enableBooleantrue, falseNo
import_route_targetsListStringNo
import_route_targets_stitchingListStringNo
export_route_targetsListStringNo
export_route_targets_stitchingListStringNo

route_replicate (iosxe.devices.configuration.vrfs.address_family_ipv4)

Section titled “route_replicate (iosxe.devices.configuration.vrfs.address_family_ipv4)”
NameTypeConstraintMandatoryDefault Value
nameStringYes
route_mapStringNo

By segmenting the network into multiple VRFs, you achieve traffic isolation, multi-tenancy, and efficient resource utilization, making VRF essential for service providers and enterprises requiring routing separation.

Key Components:

  • VRF Name (name): The unique identifier for the VRF instance.

  • Description (description): A text description for the VRF, useful for documentation and operational clarity.

  • Route Distinguisher (route_distinguisher): Uniquely identifies routes within the MPLS VPN domain, preventing overlap.

  • Address Families (address_family_ipv4, address_family_ipv6): Enable IPv4 and/or IPv6 routing within the VRF, each containing route target configuration and route replication settings.

  • Route Replication (route_replicate): Enables selective route leaking between VRFs by replicating routes from one VRF to another, with optional route-map filtering for granular control over which routes are leaked.

  • VPN ID (vpn_id): Identifies the VPN for interoperability and management.

  • Interface Association (interface): Associates physical or logical interfaces with the VRF for traffic isolation.

Key Parameters Briefly Explained:

  • name: Sets the VRF instance name.
  • description: Adds a description to the VRF.
  • route_distinguisher: Configures the unique route identifier.
  • address_family_ipv4, address_family_ipv6: Enable IPv4/IPv6 address families with route target configuration and route replication.
  • route_replicate: Configures selective route leaking from other VRFs with optional route-map filtering.
  • vpn_id: Sets the VPN identifier.
  • interface: Associates interfaces with the VRF.

You can use these VRF parameters to define isolated routing environments on your network device. Customize the name, route distinguisher, route targets, route replication settings, and interface associations to fit your network’s segmentation and multi-tenancy needs. Adjusting these parameters lets you tailor traffic isolation, selective route leaking, and routing policies for different network domains.

ip vrf definition VRF-PROD
description Production VRF
rd 200:1
route-target export 200:10
route-target export 300:10
route-target import 200:10
route-target import 300:10
address-family ipv4
route-target import 200:11 stitching
route-target export 300:11
route-replicate from vrf global unicast all route-map RM-GLOBAL
route-replicate from vrf VRF-GUEST unicast all
exit-address-family
address-family ipv6
route-target import 200:13
route-target export 300:13 stitching
exit-address-family
!
interface GigabitEthernet0/1
ip vrf forwarding VRF-PROD
ip address 10.0.0.1 255.255.255.0

The following YAML code sets up a VRF instance on an IOS-XE device, specifying its name, description, route distinguisher, route targets for import and export, route replication for selective route leaking, and address family configurations for both IPv4 and IPv6.

iosxe:
devices:
- name: Device1
configuration:
vrfs:
- name: "VRF-PROD"
description: "Production VRF"
route_distinguisher: "200:1"
address_family_ipv4:
import_route_targets: ["200:11"]
import_route_targets_stitching: ["200:12"]
export_route_targets: ["300:11"]
export_route_targets_stitching: ["300:12"]
route_replicate:
- name: global
route_map: RM-GLOBAL
- name: VRF-GUEST
address_family_ipv6:
import_route_targets: ["200:13"]
import_route_targets_stitching: ["200:14"]
export_route_targets: ["300:13"]
export_route_targets_stitching: ["300:14"]
vpn_id: "36B:1234"