Using OSPF
Unlike BGP, OSPF does not run different routing contexts within one process. Thus, for running OSPF between the PE and CE routers, configure a separate OSPF process for each VRF that receives VPN routes through OSPF. The PE router distinguishes routers belonging to a specific VRF, by associating a particular customer interface to a specific VRF and to a particular OSPF process.
To redistribute VRF OSPF routes into BGP, redistribute OSPF under the BGP VRF address family submode.
PE1
configure terminal |
Enter configure mode |
(config)#router ospf 101 comA |
Enter OSPF router mode |
(config-router)#network 192.16.3.0/24 area 0 |
Define the network on which OSPF runs and associate area ID |
(config-router)#redistribute bgp |
Redistribute BGP |
(config-router)#exit |
Exit router mode |
(config)#router ospf 102 comB |
Enter OSPF router mode |
(config-router)#network 168.12.0.2/24 area 0 |
Define the network on which OSPF runs and associate area ID |
(config-router)#redistribute bgp |
Redistribute BGP |
(config-router)#commit |
Commit the transaction |
(config-router)#exit |
Exit router mode |
(config)#router bgp 100 |
Enter the Router BGP mode, ASN: 100 |
(config-router)#address-family ipv4 vrf ComA |
Configure VRF address family |
(config-router-af)#redistribute ospf |
Redistribute OSPF |
(config-router-af)#exit-address-family |
Exit address family mode |
(config-router)#address-family ipv4 vrf ComB |
Configure VRF address family |
(config-router-af)#redistribute ospf |
Redistribute OSPF |
(config-router-af)#redistribute rip |
Redistribute RIP |
(config-router-af)#commit |
Commit the transaction |
PE2
configure terminal |
Enter configure mode |
(config)#router ospf 101 comA |
Enter OSPF router mode |
(config-router)#network 192.16.4.0/24 area 0 |
Define the network on which OSPF runs and associate area ID |
(config-router)#redistribute bgp |
Redistribute BGP |
(config-router)#exit |
Exit router mode |
(config)#router ospf 102 comB |
Enter OSPF router mode |
(config-router)#network 168.12.0.3/24 area 0 |
Define the network on which OSPF runs and associate area ID |
(config-router)#redistribute bgp |
Redistribute BGP |
(config-router)#commit |
Commit the transaction |
(config-router)#exit |
Exit router mode |
(config)#router bgp 100 |
Enter the Router BGP mode, ASN: 100 |
(config-router)#address-family ipv4 vrf ComA |
Configure VRF address family |
(config-router-af)#redistribute ospf |
Redistribute OSPF |
(config-router-af)#exit-address-family |
Exit address family mode |
(config-router)#address-family ipv4 vrf ComB |
Configure VRF address family |
(config-router-af)#redistribute ospf |
Redistribute OSPF |
(config-router-af)#redistribute rip |
Redistribute RIP |
(config-router-af)#commit |
Commit the transaction |