One router, several customers
A service provider edge router, or a campus core that separates departments, can carry several independent networks. A VRF gives each one its own routing table and interfaces. Each VRF runs its own OSPF process, so neighbours, link-state databases and routes stay separate.
On small screens, swipe sideways or focus the diagram and use the arrow keys.
Configure a VRF and an OSPF process
Create the VRF, place the interface in it, and only then set the address: moving an interface into a VRF removes its IP address.
vrf definition CUST-A
address-family ipv4
exit-address-family
!
interface GigabitEthernet0/1
vrf forwarding CUST-A
ip address 10.1.0.1 255.255.255.252
!
router ospf 10 vrf CUST-A
router-id 10.255.10.1
network 10.1.0.0 0.0.0.3 area 0R2, global configuration. Repeat for CUST-B with Gi0/2 and 'router ospf 20 vrf CUST-B'. Each VRF needs its own OSPF process.
Verify per VRF
show ip ospf neighbor
show ip ospf 10 neighbor
show ip route vrf CUST-A ospf
ping vrf CUST-A 10.1.0.2Add the process number or vrf keyword to see one VRF. A plain show or ping reads the global table.
R2#show ip route vrf CUST-A ospf Routing Table: CUST-A O 10.1.1.0/24 [110/2] via 10.1.0.2, 00:03:42, GigabitEthernet0/1
If a neighbour does not form, compare the same things as in any OSPF link, and also check that both the interface and the process are in the right VRF. An interface in the global table cannot form an adjacency with a process that belongs to a VRF.
Check your understanding
You add 'vrf forwarding CUST-A' to an interface that already has an address. What happens to the address?
How many OSPF processes does a router need for two VRFs and the global table?
'show ip route ospf' on R2 shows nothing, but CUST-A has OSPF neighbours. What is likely missing?