Pcornel
Networking · Virtualization & Overlays

VRF

Cheat sheet · https://pcornel.dk/topic.php?topic=696

Back to the Topic

Answer

VRF-Lite creates multiple isolated Layer-3 routing and forwarding contexts on one device without requiring MPLS.

Remember

  • Interface membership selects the VRF before route lookup
  • Each VRF has an independent RIB/FIB and neighbor context
  • Moving an interface into a VRF can remove its IP configuration on some platforms
  • Inter-VRF communication requires an explicit leak, firewall or routed boundary.

First checks

  • show vrf / show vrf detail — VRFs, interfaces and RD/RT.
  • show ip route vrf <name> — the VRF routing table.
  • show ip interface brief vrf <name> — interfaces in the VRF.
  • ping vrf <name> <ip> source <if> / traceroute vrf <name> <ip> — tests inside the VRF.
  • show ip arp vrf <name> — neighbours resolved in the VRF.
  • show run | section vrf — routing protocol instances or address families per VRF.

Commands

show ip vrf
Lists the VRFs with their route distinguisher and the interfaces assigned to each.
show ip route vrf <vrf>
IPv4 RIB for a specific VRF.
show vrf
VRF definitions and attached interfaces.
interface <interface>
Enter interface configuration mode.
ip address <address> <mask>
Assign an IPv4 address and mask to an interface.
vrf definition <name>
Create a VRF (multi-address-family syntax).
rd <rd>
Set the route distinguisher of a VRF (needed for MP-BGP VPNs).
address-family ipv4
Enter the IPv4 address family under a VRF definition.
address-family ipv6
Enter the IPv6 address family under a VRF definition.
vrf forwarding <name>
Assign an interface to a VRF; this removes its IP address, so add it again.
ip route vrf <name> <network> <mask> <next-hop>
Configure a static route inside a VRF.
show ip route vrf <name>
Display the routing table of a VRF.
ping vrf <name> <destination>
Ping a destination using the routing table of a VRF.

Verify in this order

VRF defined → interfaces assigned (address re-applied) → routing per VRF → VRF routing table has the routes → traffic stays inside the VRF → leaking only where intended

Where it usually breaks

underlay IP/transport → control/session registration → route/endpoint distribution → policy/segment → encapsulation/tunnel state → decapsulation/egress → return path

VRF · operational reference

ObjectContext rule
L3 interfaceBelongs to one routing context at a time
RouteInterpreted inside its VRF/global table
Ping/tracerouteMust use intended VRF/source to prove that context
Shared serviceNeeds VRF-aware reachability or explicit leak

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=696

Confirmation

Confirm action

Continue?