VRF über OSPF Routing mit BGP VPN

Es erfolgt ein Routing von 2 VRFs über MPLS
Es können sich nur erreichen CE1A und CE2A sowie CE1B und CE2B

Die Router PE1-P1-P2-PE2 tauschen ihre Routen über den OSPF Prozess 33 aus.

Somit kann dann über BGP ein VPN zwischen PE1 und PE2 aufegbaut werden.
Die Übertragung der Daten erfolgt über das Protokoll MPLS

Auf den Routern CE1A,CE2A und CE1B, CE2B sind die OSPF Area 1 und 0 angelegt, in den Prozessen 1 (CE1A,CE2A) und 2 (CE1B,CE2B)
Area 1 für die Loopback Adresse
Area 0 für die Interface Adresse
Prozess 1 für VRF CustA
Prozess 2 für VRF CustB

Auf den Routern PE1 und PE2 finden sich der OSPF Prozesse 1 und 2 wieder und in diesem sind die Areas 0 und 1 entsprechend den Netzen zugewiesen,
so das die OSPF prozesse für die VRFs geteilt sind

Config der PE Router

PE1

hostname PE1
!
ip vrf CustA <– Festlegen VRF mit namen CustA
rd 1:10
route-target export 1:10
route-target import 1:10
!
ip vrf CustB <– Festlegen VRF mit namen CustB
rd 2:20
route-target export 2:20
route-target import 2:20
!
ip cef
no ipv6 cef
!
mpls label protocol ldp <– MPLS LDP generiert selbständig Labels für den Austausch
!
!
interface Loopback0
ip address 192.168.1.17 255.255.255.255
!
interface Ethernet0/0
description link to CE1A
ip vrf forwarding CustA <– Interface VRF zuweisen
ip address 172.16.11.18 255.255.255.240
!
interface Ethernet0/1
description link to CE1B
ip vrf forwarding CustB <– Interface VRF zuweisen
ip address 172.16.11.34 255.255.255.240
!
interface Ethernet0/2
description link to P1
ip address 192.168.1.49 255.255.255.240
mpls label protocol ldp <– Interface ins MPLS aufnehmen und Label automatisch erstellen lassen
mpls ip
!
router ospf 1 vrf CustA <– OSPF für VRF CustA anlegen
redistribute bgp 65001 subnets <– BGP Routen in OSPF aufnehmen inklusive Subnets
network 172.16.0.0 0.0.255.255 area 0
!
router ospf 2 vrf CustB <– OSPF für VRF CustB anlegen
redistribute bgp 65001 subnets <– BGP Routen in OSPF auffnehmen
network 172.16.0.0 0.0.255.255 area 0
!
router ospf 33
network 192.168.1.0 0.0.0.255 area 33
!
router bgp 65001
bgp log-neighbor-changes
neighbor 192.168.1.33 remote-as 65001 <– BGP Nachbarn festelegen
neighbor 192.168.1.33 update-source Loopback 0 <– BGP Nachbar Interface
!
address-family vpnv4 <– VPN über BGP erstellen
neighbor 192.168.1.33 activate <– VPN Gegenstelle
neighbor 192.168.1.33 send-community both
neighbor 192.168.1.33 next-hop-self
exit-address-family
!
address-family ipv4 vrf CustA <– VRF in BGP aufnehmen
redistribute ospf 1 <– OSPF VRF CustA in BGP importieren
exit-address-family
!
address-family ipv4 vrf CustB <– VRF in BGP aufnehmen
redistribute ospf 2 <– OSPF VRF CustB in BGP importieren
exit-address-family
!
ip forward-protocol nd
!
mpls ldp router-id Loopback0 <– MPLS Router ID festelegen
!

PE2

hostname PE2
!
ip vrf CustA
rd 1:10
route-target export 1:10
route-target import 1:10
!
ip vrf CustB
rd 2:20
route-target export 2:20
route-target import 2:20
!
ip cef
no ipv6 cef
!
multilink bundle-name authenticated
mpls label protocol ldp
!
interface Loopback0
ip address 192.168.1.33 255.255.255.255
!
interface Ethernet0/0
description link to CE2A
ip vrf forwarding CustA
ip address 172.16.22.18 255.255.255.240
!
interface Ethernet0/1
description link to CE2B
ip vrf forwarding CustB
ip address 172.16.22.34 255.255.255.240
!
interface Ethernet0/2
description link to P2
ip address 192.168.1.65 255.255.255.240
mpls ip
!
!
router ospf 1 vrf CustA
redistribute bgp 65001 subnets
network 172.16.0.0 0.0.255.255 area 0
!
router ospf 2 vrf CustB
redistribute bgp 65001 subnets
network 172.16.0.0 0.0.255.255 area 0
!
router ospf 33
network 192.168.1.0 0.0.0.255 area 33
!
router bgp 65001
bgp log-neighbor-changes
neighbor 192.168.1.17 remote-as 65001
neighbor 192.168.1.17 update-source Loopback0
!
address-family vpnv4
neighbor 192.168.1.17 activate
neighbor 192.168.1.17 send-community both
neighbor 192.168.1.17 next-hop-self
exit-address-family
!
address-family ipv4 vrf CustA
redistribute ospf 1
exit-address-family
!
address-family ipv4 vrf CustB
redistribute ospf 2
exit-address-family
!
ip forward-protocol nd
!
!
no ip http server
no ip http secure-server
!
!
!
mpls ldp router-id Loopback0
!
control-plane
!

P1 P2
!
hostname P1
!
ip cef
no ipv6 cef
!
mpls label protocol ldp
!
interface Loopback0
ip address 192.168.1.81 255.255.255.255
!
!
interface Ethernet0/2
description link to PE1
ip address 192.168.1.50 255.255.255.240
mpls ip
!
interface Ethernet0/3
ip address 192.168.1.113 255.255.255.240
mpls ip
!
router ospf 33
network 192.168.1.0 0.0.0.255 area 33
!
ip forward-protocol nd
!
mpls ldp router-id Loopback0
!
!
hostname P2
!
ip cef
no ipv6 cef
!
mpls label protocol ldp
!
interface Loopback0
ip address 192.168.1.97 255.255.255.255
!
interface Ethernet0/2
description link to PE2
ip address 192.168.1.66 255.255.255.240
mpls ip
!
interface Ethernet0/3
description link to P1
ip address 192.168.1.114 255.255.255.240
mpls ip
!
router ospf 33
network 192.168.1.0 0.0.0.255 area 33
!
ip forward-protocol nd
!
mpls ldp router-id Loopback0
!