Cisco IOS-XR BGP Labeled Unicast (RFC 3107) Setup - 夜莺博客

Cisco IOS-XR BGP Labeled Unicast (RFC 3107) Setup

BGP labeled unicast (BGP-LU), defined in RFC 3107 as "Carrying Label Information in BGP-4", lets a router distribute MPLS labels alongside IPv4 or IPv6 prefixes inside BGP itself. It is the foundation of Inter-AS Option B and Option C designs, and the transport of choice for service providers who want to run MPLS without an IGP-plus-LDP core. IOS-XR implements it with a small number of commands, but the failure modes are subtle: the session comes up, prefixes are exchanged, and there is simply no label in the forwarding path. This guide covers the working configuration and the checks that prove the label allocation actually happened.

What BGP-LU gives you

Instead of learning labels from LDP, the router allocates a local label for the prefixes it will advertise and sends that label as a BGP attribute (SAFI 4) to its labeled-unicast neighbours. The design consequence is that the label is scoped to the BGP session, so you can build an end-to-end LSP across autonomous systems without any LDP adjacency between them. It also lets one session carry both labeled and unlabeled paths for the same prefix, which is exactly what Inter-AS deployments need during a migration.

Enabling the hardware profile on newer platforms

On Cisco 8000 series routers the feature is gated behind a hardware profile and a restart:

Router(config)# hw-module profile cef bgplu enable
Router# reload

Configuring label allocation

Labels are only allocated when you explicitly ask for it. The allocate-label command lives under the IPv4 (or IPv6) unicast address family in router BGP:

RP/0/0/CPU0:R4# configure
RP/0/0/CPU0:R4(config)# router bgp 65003
RP/0/0/CPU0:R4(config-bgp)# address-family ipv4 unicast
RP/0/0/CPU0:R4(config-bgp-af)# redistribute connected
RP/0/0/CPU0:R4(config-bgp-af)# allocate-label all
RP/0/0/CPU0:R4(config-bgp-af)# commit

allocate-label all allocates a local label for every prefix; the alternative form takes a route policy so you can restrict label allocation to a subset:

RP/0/0/CPU0:R4(config-bgp-af)# allocate-label route-policy LABELED-ONLY

Since IOS-XR 6.5.1 there is also unlabeled-path, which makes the router allocate a label even for paths that arrived unlabeled (SAFI 1):

RP/0/0/CPU0:R4(config-bgp-af)# allocate-label all unlabeled-path

Configuring the labeled-unicast neighbour

address-family ipv4 labeled-unicast can only be configured under the neighbour, never under router bgp — but the IPv4 unicast family must exist in router BGP first, which is a restriction that catches people out during first-time builds:

RP/0/0/CPU0:R4(config-bgp)# neighbor 10.100.1.7
RP/0/0/CPU0:R4(config-bgp-nbr)# remote-as 65003
RP/0/0/CPU0:R4(config-bgp-nbr)# update-source Loopback0
RP/0/0/CPU0:R4(config-bgp-nbr)# address-family ipv4 unicast
RP/0/0/CPU0:R4(config-bgp-nbr-af)# route-reflector-client

RP/0/0/CPU0:R4(config-bgp-nbr)# address-family ipv4 labeled-unicast
RP/0/0/CPU0:R4(config-bgp-nbr-af)# route-reflector-client
RP/0/0/CPU0:R4(config-bgp-nbr-af)# commit

For eBGP between ASBRs the same structure applies, with the neighbour reachable over a multihop session on loopback addresses. One detail worth remembering from Inter-AS designs: when the path between ASBRs is an IGP+LDP path you need the mpls keyword on the multihop session so the label is meaningful:

RP/0/0/CPU0:ASBR1(config-bgp-nbr)# ebgp-multihop 255 mpls

Verifying that labels exist in the forwarding path

RP/0/0/CPU0:R4# show bgp ipv4 labeled-unicast summary
RP/0/0/CPU0:R4# show bgp ipv4 labeled-unicast
RP/0/0/CPU0:R4# show bgp ipv4 unicast 10.100.1.7/32
RP/0/0/CPU0:R4# show mpls forwarding labels
RP/0/0/CPU0:R4# show bgp neighbor 10.100.1.7
  • show bgp ipv4 labeled-unicast lists prefixes exchanged as SAFI 4 with their local and remote labels.
  • show mpls forwarding is the proof point: if the prefix has no local label there, the LFIB has nothing to swap and traffic will be dropped or forwarded unlabeled depending on the platform.
  • show bgp neighbor under the IPv4 unicast address family prints a line such as "Advertise routes with local-label via Unicast SAFI" which tells you whether the router will or will not advertise the labeled route as an unlabeled one.

Common failure modes

  • Prefixes exchanged but no label in LFIB — allocate-label is missing from the router-level address family. Add it and note that removing it later requires a BGP process restart before the local labels are withdrawn.
  • Neighbour never reaches Established for SAFI 4 — the IPv4 unicast family was not configured in router BGP. The labeled-unicast family depends on it.
  • Label present but traffic still blackholes — check the next hop: with an unlabeled path the router may have no LFIB entry for the next-hop-derived label. allocate-label all unlabeled-path is the deliberate fix for this case.
  • Duplicate or unexpected unlabeled advertisements — use advertise local-labeled-route disable under the neighbour address family to stop advertising a locally labeled route as unlabeled.

See also: Cisco IOS-XR MPLS LDP configuration, MPLS L3VPN VRF and route-target configuration, and IOS-XR commit and rollback management.

原文链接:https://www.cisco.com/c/en/us/support/docs/ip/border-gateway-protocol-bgp/216498-labeled-and-unlabeled-together-on-one-bg.html