MPLS Label Anti-Spoofing¶
Solution to secure BGP Option B against MPLS label spoofing on MX Series routers.
Introduction¶
Solution to secure BGP Option B against MPLS label spoofing, supported from Junos OS 16.1, MX platform with Trio(TM) chipset.
This capability would be beneficial for service providers or cloud providers who need to compartmentalize a network at scale.
RFC 4364 section 10b is describing a method also called Inter-AS Option B where two sites of a VPN are connected to different AS (Autonomous Systems) because they are connected to different SP (service providers) or when SPs need to compartmentalize network while keeping the same AS number.
Note that BGP Option B can be in a form of Intra-AS as described in: draft-smn-idr-inter-domain-ibgp-01 https://datatracker.ietf.org/doc/draft-smn-idr-inter-domain-ibgp/
In this case, the term DBR (Domain Boundary Router) is used instead of ASBR.
Inter-AS BGP Option B is accomplished by using family inet-vpn (SAFI=128) session between ASBRs (Autonomous System Boundary Router) exchanging labels with eBGP. Option B is a more scalable alternative to Option A. In Option B, Inter-AS VPN routes are stored only in the BGP RIBs, as opposed to Option A which results in ASBRs creating multiple VRF-to-VRF tables, each of which includes all IP routes.
Although BGP Option B is highly scalable and may be considered as a simple solution to compartmentalize a network, it is vulnerable to unauthorized labeled forwarding and/or label spoofing.
Some may claim RD and RT filtering is "good enough" and indeed it provides some level of security, however, it does not protect against MPLS label spoofing.
This feature is briefly described in BGP Signaled MPLS Namespaces section 6.1.4: https://www.ietf.org/archive/id/draft-kaliraj-bess-bgp-sig-private-mpls-labels-06.html#section-6.1.4
Problem Statement¶
BGP Option B is unable to ensure that the provider network is protected in the event of incorrect RD (route distinguisher) advertisements or spoofed MPLS labels.
In the diagram below, DBR2 will accept any erroneously sent MPLS-packets for L3VPNs and from DBR2 as-well, though no VPN routes were advertised to the DBR1 in the untrusted region. Thus, DBR1 can inject MPLS packets towards PE1 or PE2 VRFs. A security concern, hostile user can attack MPLS nodes in the internal network of the service provider such as remote P and PE by spoof MPLS label.
Policy-based RD filtering ensures that only RDs generated within the service provider domain are accepted. At the same time, the filtering can be used to filter loopback VPN-IPv4 addresses generated by PIM Rosen implementations from Cisco PEs, which can cause routing issues and traffic loss if imported into customer VRF tables.

Solution¶
Junos OS anti-spoofing support for Option B implementations works by creating distinct MPLS forwarding table contexts. A separate mpls.0 table is created for each set of VPN ASBR peers. As such, each MPLS forwarding table contains only the relevant labels advertised to the group of Inter/Intra AS-Option B peers.
Option B will be reachable through local interfaces that have been configured as part of the MPLS Forwarding Instance (MFI) which is the new routing-instance created for the Inter-AS / Intra-AS BGP neighbors that requires MPLS spoof-protection. MPLS packets arriving from the Option B peers are resolved in the (MFI) instance-specific MPLS forwarding table.
Spoof checking occurs between any peers with different mpls-forwarding MFIs. For peers with the same forwarding-context, spoof-checking is not necessary because peers share the same MFI.mpls.0 table.
Optional: Family route-target (Route Target Constrain or RTC) can be enabled on the BGP session between the Trusted and Untrusted zone to further reduce the number of labels installed in MFI.mpls.0 table from unwanted VPN labels to only VPN labels required by the Untrusted zone.
An optional tunnel can be used to emulate point-to-point connectivity and so there will be a dedicated interface associated to the newly created table. This is useful to further filter against intra-VRF attacks targeting remote PE interface in a VRF.
DBR2 (Domain Boundary Router) will only forward traffic through PE2 if the VPN service label installed is in the newly created instance: MFI.mpls.0 instance. Transport labels of PE2 or other P/PE nodes will not be copied from global mpls.0 to the MFI.mpls.0 table.
In the example below, a GRE tunnel is used to emulate point-to-point between the DBRs; MPLS can be disabled in the underlay interfaces where IGP or BGP Unicast is configured to exchange interface routes between the nodes.

Analyzing of label advertisement with MPLS anti-spoofing enabled for BGP option 10b:


Configuration¶
Secure BGP option 10b: MPLS label anti-spoofing with GRE and RTC: to enable anti-spoofing support for MPLS labels, configure separate instances of the new routing instance type, mpls-forwarding, on all MPLS-enabled Inter-AS or Intra-AS links. In the example below, GRE tunnel has been used to emulate point-to-point connectivity allowing MPLS family to be disabled at the physical interfaces under this GRE.
Then configure each Option B peer to use this routing instance as its forwarding-context under BGP. This forms the transport session with the peers and performs forwarding functions for traffic from peers.
Creation of MFI MPLS table, and changing existing BGP neighbor towards MFI instance for data-forwarding and transport-session.
DBR2:
Copy IP interface routes from MFI IP table to IP MPLS (inet.3) table.
DBR2:
Optional GRE configuration.
DBR2:
Optional RTC configuration.
DBR1:
DBR2:
Notes:
- When GRE tunnel interface is used between DBR1 to DBR2, user can decide to remove family MPLS from the physical interface.
- This technique of anti-spoofing support for MPLS labels is also supported on mixed networks.
Verification¶
Quick view on DBR2, only service label of shared VPN from Trusted to Untrusted region is installed in MFI.mpls.0 table.
Interface primary route is in MFI.inet.0 table copied into inet.3 table:
Perform these tasks to verify that BGP secure option 10b works properly:**
PE1: Show VPN route towards CE2-A
P1: Show MPLS label route
DBR1: Show MPLS label route
DBR1: Show L3VPN route
DBR2: Show MPLS label route
DBR2: Show L3VPN route
DBR2: Show forwarding table label route Traffic coming to the Trusted region is processed through MFI.mpls.0 instance where only service VPN labels are installed. This prevents the Untrusted region from reaching MPLS transport labels of nodes in the Trusted zone.
DBR2: Reverse path, show forwarding table label route towards CE1-A
PE2: Reverse path, show MPLS label route towards CE1-A
PE2: Reverse path, show L3VPN route towards CE1-A
Appendix¶
Generic Routing Encapsulation (GRE) in Trio chipset¶
On Trio silicon-based line cards, tunnel services are built into each PFE; there is no need to disable a port to allow the tunnel services.
Since the tunnel service processing happens directly on the PFE, the performance is near line-rate and keeps the latency to a minimum.
The following are some of the tunnel interface characteristics when tunnel-services are enabled.
- The interface name for GRE in Junos is "gr-".
- The bandwidth that is specified determines the port number of the tunnel interfaces that will be created.
When a bandwidth of 1g is specified, the port number is always 10. When any other bandwidth is specified, the port number is always 0.
You can configure GRE on different FPC and PIC from the physical port, in this case traffic will go over the fabric cards.

Configuring BGP Route Target Filtering for VPNs¶
BGP route target filtering allows you to advertise VPN routes to only the routers that require them. By filtering advertisement of VPN routes, BGP route target filtering is helping to minimize the risk of attacking CEs in trusted region that do not share a common VPN between the two regions.
BGP route target filtering is enabled through the exchange of the route-target address family, stored in the bgp.rtarget.0 routing table. Based on the route-target address family, the route target NLRI (SAFI=132) is negotiated with its peers.
Knobs used in this article:¶
- Instance-type mpls-forwarding Allow filtering and translation of route distinguisher (RD) values in IPv4 and IPv6 VPN address families on both routes received and routes sent for selected BGP sessions. For BGP Option-B, this feature can prevent the malicious injection of VPN labels from one peer AS boundary router to another.
- BGP family route-target for filtering VPN routes before they are sent. Provider edge (PE) routers inform the route reflector (RR) which routes to send, using family route-target to provide the route-target-interest information. The RR then sends to the PE router only the advertisements containing the specified route target.
- BGP session with forwarding-context setting is required in conjunction with mpls-forwarding to protect against label spoofing across AS boundary routers in the context of Inter-AS VPN Option B for AS boundary routers.
Useful links¶
- Anti-spoofing support for MPLS labels in BGP/MPLS IP VPNs (Inter-AS Option B) https://www.juniper.net/documentation/us/en/software/junos/multicast/topics/concept/anti-spoofing-support-for-mpls-labels.html
- Interconnecting domains with Multiprotocol IBGP draft: draft-smn-idr-inter-domain-ibgp-01 https://datatracker.ietf.org/doc/draft-smn-idr-inter-domain-ibgp/
- Configuring GRE tunnel interface: https://www.juniper.net/documentation/us/en/software/junos/interfaces-encryption/topics/topic-map/configuring-gre-tunnel-interfaces.html
- Configuring BGP Route Target Filtering for VPNs https://www.juniper.net/documentation/us/en/software/junos/vpn-l3/topics/topic-map/l3-vpns-route-target-filtering.html#id-configuring-bgp-route-target-filtering-for-vpns
- Configuring Inter provider VPN: https://www.juniper.net/documentation/us/en/software/junos/vpn-l3/topics/topic-map/l3-vpns-interprovider.html#id-example-configuring-interprovider-layer-3-vpn-option-b
- IETF Draft: https://www.ietf.org/archive/id/draft-kaliraj-bess-bgp-sig-private-mpls-labels-06.html#section-6.1.4
Glossary¶
- AS: Autonomous System
- ASBR: Autonomous System Boundary Router
- BGP: Border Gateway Protocol
- CE: Customer Edge
- Cluster-id: Cluster-Identifier to be used by the route reflector cluster in an internal BGP group
- DBR: Domain Boundary Router
- EBGP: External Border Gateway Protocol
- FPC: Flexible PIC Concentrators
- GRE: Generic Routing Encapsulation
- IBGP: Internal Border Gateway Protocol
- IGP: Interior Gateway Protocol
- inet.0: IPv4 table. Stores interface local and direct routes, static routes, and dynamically learned routes.
- inet6.0: IPv6 table. Stores interface local and direct routes, static routes, and dynamically learned routes.
- inet.3: IP MPLS table. Stores the egress address of an MPLS label-swiched, the LSP name, and the outgoing interface name. This routing table is used only when the local device is the ingress node to an LSP.
- inet-vpn: NLRI parameters for IPv4 for Layer 3 VPNs
- IP: Internet Protocol
- Junos: Junos Operating System used in Juniper Networks routing, switching and security devices.
- LSP: Label-Swiched Path
- LSR: Label Switch Router
- MFI: MPLS Forwarding Instance
- MPLS: Multiprotocol Label Switching
- MX: Multi-Service router with programmable silicon
- NLRI: Network Layer Reachability Information
- P: Provider router is a label switch router that functions as a transit router of the core network.
- PE: Provider Edge router
- PFE: Packet Forwarding Engine
- PIC: Physical Interface Cards
- RD: Route Distinguisher
- RIB: Routing Information Base
- RT: Route Target
- RTC: Route Target Constrain or RT-Constrain is based on RFC 4684
- SAFI: Subsequent Address Family Identifiers
- Trio: Juniper silicon. multi-threaded programmable packet processing engine and a hierarchy of high-capacity memory systems
- VPN: virtual private network