VRF static and dynamic routing

Static Routing under VRF:

Say yor VRF name is “Marketing”. Your static route configuration will looks like below:

Cisco(Config)#ip route vrf  Marketing 151.52.10.0 255.255.255.0 146.150.2.1

You can view this route using:

Cisco#sh ip route vrf Marketing

 

Dynamic Routing under VRF:

Unlike static routing protocols, dynamic routing protocols (ospf, RIP, etc)  automatically exchange and distribute rout information with its neighboring routers.

First step is to enable ospf using a process id as follows and then advertise the network under that process id.

CiscoR1(config)#router ospf 1

CiscoR1(config-router)# network 146.111.20.0 0.0.0.255 area 0

first command start the routing instance 1 and the second command places  the network interface that is configured for network 146.111.20.0/24 under area 0.

the above command will enable the ospf routing under global routing table.

If you happen to have VRF, these routing commands need to go under the VRF configuration.

Say you need to have two VRF instances, one for marketing and one for finance. Here is how to advertise the route under marketing VRF:

CiscoR1(config)#router ospf 1 vrf Marketing

CiscoR1(config-router)#network 146.111.20.0 0.0.0.255 area 0

CiscoR1(config-router)#capability vrf-lite