Ab - MPLS VPN
Ab - MPLS VPN
• The PE routers have direct connection with CE routers and run routing
protocol or static routing between them.
• In MPLS VPN, both P and PE routers run MPLS, CE routers need not run
MPLS.
• The CE router does not peer with remote CE, infact, it only peers with the PE
router (PE routers in case of multihomed).
• The customer IP packets are labeled in the service provider network to achieve
a private VPN for each customer. The P routers are completely unaware of the
customer routes.
• The VPN routes are only known to the edge routers. So BGP is not needed on
P routers.
• The VPN prefixes are propagated through the MPLS VPN network using MP-
BGP but these prefixes should be unique.
• So each prefix received from the customer receives a unique identifier (the
RD) to distinguish the same prefix from different customers.
• The vpnv4 prefix is derived by combining the RD and the IPv4 prefix. MP-
BGP carries these vpnv4 prefixes between the PE routers.
• An RD is a 64-bit field and each VRF instance should have an RD attached to
it.
• An RD can be one of two formats: ASN:nn (most preferred) or IP-
address:nn.
• The PE router receives IPv4 routes from the CE router using IGP/ eBGP.
These IPv4 routes are put into the VRF table according to the VRF instance
configured on the interface on which these routes are received.
• The PE router appends the RD to these IPv4 prefixes and converts them to
vpnv4 prefixes. These vpnv4 routes are put into MP-BGP using redistribution.
• BGP advertises these vpnv4 routes to all its PE neighbors after adding the RTs
(export RT) using iBGP.
• At remote PE router, the RD is removed from vpnv4 prefixes to make them
IPv4 prefixes.
• The IPv4 prefixes are inserted into VRF routing tables on the remote PE
router.
• Using IGP/ eBGP, the IPv4 routes are advertised to the remote CE router.
• In MPLS VPN network, all customer packets are forwarded using two labels-
the top label as IGP label and the bottom label as VPN label.
• The IGP label is the label advertised by the downstream router in the service
provider network. This label corresponds to the next-hop. This label is
advertised by LDP and the P routers use this label to switch packets.
• The VPN label is the label advertised by the egress PE router to the ingress PE
router indicating to which VRF table this packet would belong to. Essentially,
the VPN label indicates the next-hop CE router that this packet belongs to.
These attributes hold two fields: Address Family Identifier (AFI= 2 bytes) and
Subsequent Address Family Identifier (SAFI= 1 byte). For IPv4, the AFI=1. For IPv6,
the AFI=2.
To support Multiprotocol behavior of BGP, the BGP routing process has the concept
of address family. The four address families currently supported are IPv4, IPv6,
vpnv4 and vpnv6.
Label distribution can be piggybacked in the BGP Update Message by using the BGP-
4 Multiprotocol Extensions attribute. The label is encoded into the NLRI field of the
attribute, and the SAFI field (value=4) is used to indicate that the NLRI contains the
label.
The NLRI is encoded as one or more triples of the form <length, label, prefix>.
Length- The Length field indicates the length in bits of the address prefix plus the
label(s).
Label- The Label field carries one or more labels. Each label is encoded as 3 octets,
where higher-order 20 bits contain the label value and lower-order 1 bit is the bottom-
of-stack bit.
Prefix- The Prefix field contains the address prefixes followed by enough trailing bits
to make the end of the field fall on an octet boundary.
The debug ip bgp command should show AFI/SAFI compatibility values negotiated
between BGP neighbors. For MPLS VPN, AFI/SAFI values 1/1, 1/4 and 1/128 values
should be agreed upon by BGP neighbors.
The show ip bgp neighbor <ip-address> command should also show Neighbor
Capabilities.
BGP Multipath:
By default, BGP only selects a single best path and installs in the routing table. BGP
Multipath is a BGP feature whereby the selection process still selects a best path but
allows multiple paths to be installed in the routing table.
If ingress PE1 and PE2 routers advertise CE (multihomed to PE1 and PE2) routes
with same RD, the RR installs only the best path in its routing table and then
advertises only that best path to the egress PE3 router.
When PE1 and PE2 routers advertise the vpnv4 routes with different RD to the RR,
these routes are considered different and hence, the RR installs both routes into its
routing table. Further advertises both vpnv4 routes to PE3 router.
If PE3 router is configured with BGP Multipath iBGP feature, it installs both vpnv4
routes.
PE3 router:
The import keyword indicates how many routes can be imported from one VRF to
another.
NOTE: Both CE1 and CE2 routers belong to CUST_ONE (part of one customer).
1) Static routing:
2) RIPv2 routing:
CE1 router:
router rip
version 2
network 172.16.0.0
network 192.168.1.0 ! internal network
no auto-summary
!
PE1 router:
router rip
no auto-summary
address-family ipv4 vrf CUST_ONE
network 172.16.0.0
redistribute bgp 100
default-metric 3 (by default, the redistributed metric is 2)
version 2
exit-address-family
!
router bgp 100
!
address-family ipv4 vrf CUST_ONE
redistribute rip
redistribute connected
exit-address-family
!
3) OSPF routing:
• When OSPF is used as the PE-CE routing protocol, the MPLS VPN network
becomes the Super Backbone. Hence, all the customer OSPF routes (LSA
Type 1, 2 or 3) become interarea (IA- LSA Type 3) routes when they reach at
the remote sites. The external routes (LSA Type 5) routes remain external
routes at the remote sites.
• Hence, the PE routers become ABR and ASBR.
• If the customer sites have a backdoor link, all the internal OSPF routes will be
advertised without change- in essence, all intraarea routes are advertised as
intraarea. So, when the routes are received from the MPLS VPN backbone,
they are interarea routes and will not be preferred over intraarea routes. To
avoid this, a feature called sham-link was introduced.
CE1 router:
router ospf 42
network 172.16.1.0 0.0.0.3 area 0
!
PE1 router:
The above output shows that the MPLS VPN network is a MPLS VPN
Superbackbone.
The output shows that the OSPF route (172.16.2.0) received from remote CE2 router
is Interarea route denoted by IA.
This output shows BGP extended communities for OSPF- OSPF RT, OSPF Domain-
id and OSPF Router-id.
OSPF RT is OSPF route type. 0.0.0.0 is area 0, 2 is OSPF route-type and 0 is option.
Configure a separate /32 address on the PE routers so that OSPF packets can be sent
over the MPLS VPN backbone.
• The /32 address must belong to the vrf
• The /32 address should be advertised by iBGP, not OSPF.
• Associate the sham-link with an existing OSPF area
The link between R3 and R5 is the backdoor link. If the sham-link is not configured
between PE routers R0 and R1, the backdoor link will be preferred over MPLS VPN
network all the time.
• The down bit is the bit that is set in the Options field of an OSPF LSA Type-3
• If an OSPF route has been advertised by a PE router into an OSPF area, the
down bit is set.
• Another PE router in the same area will not redistribute this route into MP-
iBGP if the down bit is set. The PE router does not even include the route for
SPF calculation. This can avoid routing loops.
• The domain tag has the same purpose as the down bit but for OSPF external
routes (LSA Type-5).
• If another PE router receives the route with domain-tag set to a value and if
that value matches the configured domain-tag, it will not redistribute the route
into iBGP.
• The ASN of BGP is encoded into the tag of OSPF external routes in the least
significant 16 bits.
• The domain tag can be configured using
domain-tag <tag-value> under OSPF router vrf configuration mode.
4) EIGRP routing:
• When EIGRP is redistributed into BGP at the PE router, all EIGRP routes can
become external routes at the remote site according to usual behaviour.
• In order to alleviate this problem, as much EIGRP information is passed into
BGP extended communities. This information helps to reconstruct EIGRP
routes at the remote end.
CE1 router:
router eigrp 1
network 172.16.1.0 0.0.0.3
no auto-summary
PE1 router:
router eigrp 1
no auto-summary
!
address-family ipv4 vrf CUST1
network 172.16.1.0 0.0.0.3
no auto-summary
redistribute bgp 100 metric 1500 100 255 1 1500
autonomous-system 33
exit-address-family
!
The output shows BGP extended communities-
The cost-community ID is either 128 or 129. 128 is for EIGRP internal routes and
129 is for EIGRP external routes. Internal routes are selected over external routes.
The value is the EIGRP composite metric value set on the PE router that redistributes
EIGRP into BGP. Routes with lower metric values are selected over higher values.
5) eBGP routing:
• If the customer sites have different AS numbers, then BGP can operate with
default behaviour.
• However, if the customer sites have same AS numbers, then BGP cannot
operate with default behaviour as the customer routers will drop routes that
have their own AS number in AS-path attribute (a measure of avoiding routing
loops).
• There are two ways BGP can be adapted to provide correct routing-
1) AS Override:
Here, the PE router replaces the customer AS number with the AS number of the
service provider.
2) allowas-in:
Here, the PE router allows the multiple occurrences of the same AS number in the
AS-path. This allows an update to pass through the service provider network more
than once without BGP rejecting the update.
PE2 router:
ip vrf from_spokes
rd 1:3
route-target import 100:100
!
ip vrf to_spokes
rd 1:4
route-target export 200:200
!
interface fa 0/0.10
encapsulation dot1q 10
ip vrf forwarding from_spokes
ip address 172.16.3.1 255.255.255.252
!
interface fa 0/0.20
encapsulation dot1q 20
ip vrf forwarding to_spokes
ip address 172.16.4.1 255.255.255.252
!
router bgp 100
!
address-family ipv4 vrf from_spokes
neighbor 172.16.3.2 remote-as 65003
neighbor 172.16.3.2 activate
redistribute connected
exit-address-family
!
address-family ipv4 vrf to_spokes
neighbor 172.16.4.2 remote-as 65003
neighbor 172.16.4.2 activate
neighbor 172.16.4.2 allowas-in 10 ! range is 1-10
redistribute connected
exit-address-family
!
It can be depicted from the output of PE1 router below that it learns the prefix of
PE3 router 172.16.2.0/30 from PE2 router (2.2.2.2) where the HUB router is
connected. Hence, the spoke-to-spoke communication occurs through the HUB router.
Without the allowas-in command, the routes are not advertised to the spoke routers
since the SP AS number is already in the AS-path attribute. Hence, the PE2 router
will reject them when it comes from the HUB router.
MPLS VPN with Internet Access with Static routing:
CE1 router:
interface loopback 0
ip address 11.1.1.1 255.255.255.255
!
interface fastethernet 0/0
ip address 172.16.1.2 255.255.255.252
!
ip route 0.0.0.0 0.0.0.0 172.16.1.1
!
PE1 router:
!!! static route towards the Internet Gateway Router IGW for customer sites
Since Fastethernet 0/0 on PE1 router is a vrf interface for CUST1, this interface does
not show up in global routing table as Connected. But the static route is still present in
the global routing table even though the next-hop and outbound interface are not
present (they belong to the vrf).
Because there is no redistribution between IPv4 and vpnv4, a method is needed to
allow the PE router to resolve the next-hop for the IGW IP address (192.168.1.1) from
within the VRF. This is done using global keyword. The global keyword specifies
that the next-hop address of the static route be resolved using the global routing table
rather than VRF table.
• With Multi-VRF, two or more customers can share the same CE and only one
physical link is used between the CE and the PE.
• The shared CE maintains separate VRF tables for each customer, and routes
packets for each customer based on that customer’s own routing table.
• FINANCE VRF should not be able to communicate with MGMT VFR.
• The VRF functionality is extended to CE routers. MPLS is not enabled on CE
routers though, only VRF.
• Overlapping IP addresses can be used for different VRFs.
FINANCE router:
ip vrf FINANCE
rd 1:1
route-target both 1:1
!
interface fastethernet 0/0
ip vrf forwarding FINANCE
ip address 172.16.1.0 255.255.255.0
!
router ospf 10 vrf FINANCE
network 172.16.1.0 0.0.0.255 area 0
capability vrf-lite !disables down bit and domain tag checks
!
PE1 router:
ip vrf FINANCE
rd 1:1
route-target both 1:1
!
ip vrf MGMT
rd 1:2
route-target both 1:2
!
interface fastethernet 0/0.10
encapsulation dot1q 10
ip vrf forwarding FINANCE
ip address 172.16.1.1 255.255.255.0
!
interface fastethernet 0/0.20
encapsulation dot1q 20
ip vrf forwarding MGMT
ip address 172.16.2.1 255.255.255.0
!
router ospf 10 vrf FINANCE
network 172.16.1.0 0.0.0.255 area 0
redistribute bgp 100 metric 10 subnets
!
router ospf 20 vrf MGMT
network 172.16.2.0 0.0.0.255 area 0
redistribute bgp 100 metric 10 subnets
!
router bgp 100
!
address-family ipv4 vrf FINANCE
redistribute ospf 10 vrf FINANCE metric 10 match internal
exit-address-family
!
address-family ipv4 vrf MGMT
redistribute ospf 20 vrf MGMT metric 10 match internal
exit-address-family
!
The PE router does two types of checks when OSPF is run between PE and CE. These
checks are down bit (internal routes) and domain tag (external routes). These checks
are to avoid routing loops. If the PE router receives internal (interarea and intraarea)
routes with down bit set, those routes are rejected. Similarly, if the external routes
received by PE router have domain tag and if the value matches the one configured on
PE router, it discards those routes.
R0 router: R7 router:
R1 router: R6 router:
R2 router: R5 router:
R3 router: R4 router:
PE3 router:
interface Loopback 0
ip address 3.3.3.3 255.255.255.255
ip ospf 1 area 0
!
mpls label protocol ldp
mpls ldp router-id Loopback 0 force
!
ip vrf CUST1
rd 1:1
route-target both 1:1
!
interface fastethernet 1/0
ip vrf forwarding CUST1
ip address 172.16.2.1 255.255.255.252
ip ospf 42 area 0
!
interface fastethernet 0/0
ip address 10.1.1.2 255.255.255.252
ip ospf 1 area 0
mpls ip
!
interface fastethernet 0/1
ip address 10.2.2.2 255.255.255.252
ip ospf 1 area 0
mpls ip
!
router ospf 1
redistribute bgp 100 metric 10 subnets
!
router bgp 100
neighbor 1.1.1.1 remote-as 100
neighbor 1.1.1.1 update-source Loopback 0
neighbor 2.2.2.2 remote-as 100
neighbor 2.2.2.2 update-source Loopback 0
!
address-family vpnv4
neighbor 1.1.1.1 activate
neighbor 1.1.1.1 send-community both
neighbor 2.2.2.2 activate
neighbor 2.2.2.2 send-community both
exit-address-family
!
address-family ipv4 vrf CUST1
redistribute ospf 42 vrf CUST1 metric 10 match internal
exit-address-family
!
• Traffic from CE1 router should be only forwarded to ISP1. CE1 router
interface is associated to VPN1 VRF.
• Traffic from CE2 router should be only forwarded to ISP2. CE2 router
interface is associated to VPN2 VRF.
• Traffic that does not match any source IP address is forwarded to Null 0
interface; meaning dropped.
1) ip vrf receive <vrf-name>- to add all the IP addresses that are associated with an
interface into a VRF table. These IP addresses will be inserted as “Connected” routes
and will appear as “receive” entries in the CEF table.
2) ip vrf select source- to enable the VRF Selection feature on a particular interface
or sub-interface.
The output on PE1 router shows that 10.3.3.0/30 belongs to vrf Blue while
10.4.4.0/30 and 192.168.1.0/30 (GRE tunnel prefix) belongs to vrf Green.
Successful ping from PE2 router to CE1 fa 0/0 interface that belongs to vrf Blue
The routing table on CE4 router shows that 15.1.1.1/32 of CE1 router is available.
BGP Route-Reflection with ORF Capability:
• To filter the updates at the PE-routers so that they are not sent toward route
reflectors that do not need them, and also to make this dynamic so that
extensive filtering configuration is not necessary on the PE routers.
• Using the ORF capability, each route reflector is preconfigured with a list of
route targets that it will accept for reflection to any PE-clients.
The following output shows that the Route_Reflector router receives all the prefixes
connected to PE routers PE1, PE2 and PE3.
This output shows that PE1 router is receiving one prefix from the Route_Reflector
router.
And that prefix is 172.16.2.0/30 as it has specified only that prefix to be received from
the Route_Reflector router using ORF capability.
It shows successful ping from PE1 router to the CUST1 prefix on PE3 router.
However, the traceroute output shows that the packets are sent directly through
P_Router rather than the Route-Reflector router.
P1 router: P2 router:
The following output shows that the PE3 router has received VPNv4 routes from PE1
and PE2 routers. The AS path shows the sub-AS in parenthesis
NMS_Router:
ip vrf Net_Mgmt
rd 100:100
route-target import 100:100
!
interface Loopback 0
ip address 3.3.3.3 255.255.255.255
ip ospf 1 area 0
!
router bgp 100
neighbor 1.1.1.1 remote-as 100
neighbor 1.1.1.1 update-source Loopback 0
neighbor 2.2.2.2 remote-as 100
neighbor 2.2.2.2 update-source Loopback 0
!
address-family vpnv4
neighbor 1.1.1.1 activate
neighbor 1.1.1.1 send-community both
neighbor 2.2.2.2 activate
neighbor 2.2.2.2 send-community both
exit-address-family
!
The following output shows normal MPLS VPN operation where PE1 router receives
172.16.2.0/30 prefix from PE2 router.
The following is taken from NMS_Router which shows that it is receiving the
customer link in its Net_Mgmt VRF table. It only shows 172.16.1.0/30 as during the
time of implementation, the Export-map was configured on only PE1 router.
The following output clearly shows that the NMS_Router accepts customer routers
with only RT as 100:100. Hence, the export-map works on the PE1 router.
MPLS VPN over DMVPN (aka 2547oDMVPN):
• In MPLS VPN, the top label represents the route across the backbone to the
egress PE router. This label is called the “backbone route label”.
• The bottom label is always the “VPN route label” which is not seen until the
packet reaches it point of egress.
• Use of PE-PE IPSec in 2547 VPN specifies the procedure to replace the
backbone route label with IPSec encapsulation. In other words, the LSP is
replaced by an IPSec tunnel. In effect, this creates an MPLS in IPSec
encapsulation, in which the VPN route label is carried across the backbone in
IPSec encapsulation. The MPLS label stack will contain only one label in the
stack.
• The approach uses an MPLS-in-IP or MPLS-in-GRE encapsulation to turn an
MPLS packet back into IP packet. This creates an IP or GRE tunnel between
the ingress and egress PE routers.
• And finally, it uses IPSec Transport mode to secure the IP or GRE tunnels.
• Thus, MPLS packets gets send through an IPSec-secured IP or GRE tunnel.
PE4 router:
The following output is taken from PE1 router which shows that it is receiving
VPNv4 routes.
It shows that the route 192.168.3.1/32 received from PE3 router has been assigned a
VPN label.
The output from PE4 router shows that it has only one IPSec session i.e. with the PE1
router.
When PE4 router tries to ping the tunnel IP address of PE3 router (here, or send
traffic to PE3 router), it then dynamically creates an IPSec session with the PE3 router
instead of going through PE1 router.