Label advertisement control configuration example

Network requirements

Two links, Switch A—Switch B—Switch C and Switch A—Switch D—Switch C, exist between subnets 11.1.1.0/24 and 21.1.1.0/24.

Configure label advertisement control, so LDP sets up LSPs only on the link Switch A—Switch B—Switch C to forward traffic between subnets 11.1.1.0/24 and 21.1.1.0/24.

Figure 18: Network diagram

Requirements analysis

Configuration procedure

  1. Configure IP addresses and masks for interfaces, including the loopback interfaces, as shown in Figure 18. (Details not shown.)

  2. Configure OSPF on each switch to ensure IP connectivity between them. (Details not shown.)

  3. Enable MPLS and LDP:

    # Configure Switch A.

    <SwitchA> system-view
    [SwitchA] mpls lsr-id 1.1.1.9
    [SwitchA] mpls ldp
    [SwitchA-ldp] quit
    [SwitchA] interface vlan-interface 2
    [SwitchA-Vlan-interface2] mpls enable
    [SwitchA-Vlan-interface2] mpls ldp enable
    [SwitchA-Vlan-interface2] quit
    [SwitchA] interface vlan-interface 6
    [SwitchA-Vlan-interface6] mpls enable
    [SwitchA-Vlan-interface6] mpls ldp enable
    [SwitchA-Vlan-interface6] quit
    

    # Configure Switch B.

    <SwitchB> system-view
    [SwitchB] mpls lsr-id 2.2.2.9
    [SwitchB] mpls ldp
    [SwitchB-ldp] quit
    [SwitchB] interface vlan-interface 2
    [SwitchB-Vlan-interface2] mpls enable
    [SwitchB-Vlan-interface2] mpls ldp enable
    [SwitchB-Vlan-interface2] quit
    [SwitchB] interface vlan-interface 3
    [SwitchB-Vlan-interface3] mpls enable
    [SwitchB-Vlan-interface3] mpls ldp enable
    [SwitchB-Vlan-interface3] quit
    

    # Configure Switch C.

    <SwitchC> system-view
    [SwitchC] mpls lsr-id 3.3.3.9
    [SwitchC] mpls ldp
    [SwitchC-ldp] quit
    [SwitchC] interface vlan-interface 3
    [SwitchC-Vlan-interface3] mpls enable
    [SwitchC-Vlan-interface3] mpls ldp enable
    [SwitchC-Vlan-interface3] quit
    [SwitchC] interface vlan-interface 7
    [SwitchC-Vlan-interface7] mpls enable
    [SwitchC-Vlan-interface7] mpls ldp enable
    [SwitchC-Vlan-interface7] quit
    

    # Configure Switch D.

    <SwitchD> system-view
    [SwitchD] mpls lsr-id 4.4.4.9
    [SwitchD] mpls ldp
    [SwitchD-ldp] quit
    [SwitchD] interface vlan-interface 6
    [SwitchD-Vlan-interface6] mpls enable
    [SwitchD-Vlan-interface6] mpls ldp enable
    [SwitchD-Vlan-interface6] quit
    [SwitchD] interface vlan-interface 7
    [SwitchD-Vlan-interface7] mpls enable
    [SwitchD-Vlan-interface7] mpls ldp enable
    [SwitchD-Vlan-interface7] quit
    
  4. Configure LSP generation policies:

    # On Switch A, create IP prefix list switcha, and configure LDP to use only the routes permitted by the prefix list to establish LSPs.

    [SwitchA] ip prefix-list switcha index 10 permit 11.1.1.0 24
    [SwitchA] ip prefix-list switcha index 20 permit 21.1.1.0 24
    [SwitchA] mpls ldp
    [SwitchA-ldp] lsp-trigger prefix-list switcha
    [SwitchA-ldp] quit
    

    # On Switch B, create IP prefix list switchb, and configure LDP to use only the routes permitted by the prefix list to establish LSPs.

    [SwitchB] ip prefix-list switchb index 10 permit 11.1.1.0 24
    [SwitchB] ip prefix-list switchb index 20 permit 21.1.1.0 24
    [SwitchB] mpls ldp
    [SwitchB-ldp] lsp-trigger prefix-list switchb
    [SwitchB-ldp] quit
    

    # On Switch C, create IP prefix list switchc, and configure LDP to use only the routes permitted by the prefix list to establish LSPs.

    [SwitchC] ip prefix-list switchc index 10 permit 11.1.1.0 24
    [SwitchC] ip prefix-list switchc index 20 permit 21.1.1.0 24
    [SwitchC] mpls ldp
    [SwitchC-ldp] lsp-trigger prefix-list switchc
    [SwitchC-ldp] quit
    

    # On Switch D, create IP prefix list switchd, and configure LDP to use only the routes permitted by the prefix list to establish LSPs.

    [SwitchD] ip prefix-list switchd index 10 permit 11.1.1.0 24
    [SwitchD] ip prefix-list switchd index 20 permit 21.1.1.0 24
    [SwitchD] mpls ldp
    [SwitchD-ldp] lsp-trigger prefix-list switchd
    [SwitchD-ldp] quit
    
  5. Configure label advertisement policies:

    # On Switch A, create an IP prefix list prefix-to-b that permits subnet 11.1.1.0/24. Switch A uses this list to filter FEC-label mappings advertised to Switch B.

    [SwitchA] ip prefix-list prefix-to-b index 10 permit 11.1.1.0 24
    

    # On Switch A, create an IP prefix list peer-b that permits 2.2.2.9/32. Switch A uses this list to filter peers.

    [SwitchA] ip prefix-list peer-b index 10 permit 2.2.2.9 32
    

    # On Switch A, configure a label advertisement policy to advertise only the label mapping for FEC 11.1.1.0/24 to Switch B.

    [SwitchA] mpls ldp
    [SwitchA-ldp] advertise-label prefix-list prefix-to-b peer peer-b
    [SwitchA-ldp] quit
    

    # On Switch C, create an IP prefix list prefix-to-b that permits subnet 21.1.1.0/24. Switch C uses this list to filter FEC-label mappings advertised to Switch B.

    [SwitchC] ip prefix-list prefix-to-b index 10 permit 21.1.1.0 24
    

    # On Switch C, create an IP prefix list peer-b that permits 2.2.2.9/32. Switch C uses this list to filter peers.

    [SwitchC] ip prefix-list peer-b index 10 permit 2.2.2.9 32
    

    # On Switch C, configure a label advertisement policy to advertise only the label mapping for FEC 21.1.1.0/24 to Switch B.

    [SwitchC] mpls ldp
    [SwitchC-ldp] advertise-label prefix-list prefix-to-b peer peer-b
    [SwitchC-ldp] quit
    

    # On Switch D, create an IP prefix list prefix-to-a that denies subnet 21.1.1.0/24. Switch D uses this list to filter FEC-label mappings to be advertised to Switch A.

    [SwitchD] ip prefix-list prefix-to-a index 10 deny 21.1.1.0 24
    [SwitchD] ip prefix-list prefix-to-a index 20 permit 0.0.0.0 0 less-equal 32
    

    # On Switch D, create an IP prefix list peer-a that permits 1.1.1.9/32. Switch D uses this list to filter peers.

    [SwitchD] ip prefix-list peer-a index 10 permit 1.1.1.9 32
    

    # On Switch D, create an IP prefix list prefix-to-c that denies subnet 11.1.1.0/24. Switch D uses this list to filter FEC-label mappings to be advertised to Switch C.

    [SwitchD] ip prefix-list prefix-to-c index 10 deny 11.1.1.0 24
    [SwitchD] ip prefix-list prefix-to-c index 20 permit 0.0.0.0 0 less-equal 32
    

    # On Switch D, create an IP prefix list peer-c that permits subnet 3.3.3.9/32. Switch D uses this list to filter peers.

    [SwitchD] ip prefix-list peer-c index 10 permit 3.3.3.9 32
    

    # On Switch D, configure a label advertisement policy, so Switch D does not advertise label mappings for FEC 21.1.1.0/24 to Switch A, and does not advertise label mappings for FEC 11.1.1.0/24 to Switch C.

    [SwitchD] mpls ldp
    [SwitchD-ldp] advertise-label prefix-list prefix-to-a peer peer-a
    [SwitchD-ldp] advertise-label prefix-list prefix-to-c peer peer-c
    [SwitchD-ldp] quit
    

Verifying the configuration

# Display LDP LSP information on each switch.

[SwitchA] display mpls ldp lsp
Status Flags: * - stale, L - liberal
Statistics:
  FECs: 2      Ingress LSPs: 1     Transit LSPs: 1     Egress LSPs: 1

FEC                In/Out Label        Nexthop         OutInterface
11.1.1.0/24        1277/-
                   -/1151(L)
                   -/1277(L)
21.1.1.0/24        -/1276              10.1.1.2        Vlan-int2
                   1276/1276           10.1.1.2        Vlan-int2
[SwitchB] display mpls ldp lsp
Status Flags: * - stale, L - liberal
Statistics:
  FECs: 2      Ingress LSPs: 2     Transit LSPs: 2     Egress LSPs: 0

FEC                In/Out Label        Nexthop         OutInterface
11.1.1.0/24        -/1277              10.1.1.1        Vlan-int2
                   1277/1277           10.1.1.1        Vlan-int2
21.1.1.0/24        -/1149              20.1.1.2        Vlan-int3
                   1276/1149           20.1.1.2        Vlan-int3
[SwitchC] display mpls ldp lsp
Status Flags: * - stale, L - liberal
Statistics:
  FECs: 2      Ingress LSPs: 1     Transit LSPs: 1     Egress LSPs: 1

FEC                In/Out Label        Nexthop         OutInterface
11.1.1.0/24        -/1277              20.1.1.1        Vlan-int3
                   1148/1277           20.1.1.1        Vlan-int3
21.1.1.0/24        1149/-
                   -/1276(L)
                   -/1150(L)
[SwitchD] display mpls ldp lsp
Status Flags: * - stale, L - liberal
Statistics:
  FECs: 2      Ingress LSPs: 0     Transit LSPs: 0     Egress LSPs: 2

FEC                In/Out Label        Nexthop         OutInterface
11.1.1.0/24        1151/-
                   -/1277(L)
21.1.1.0/24        1150/-

The output shows that Switch A and Switch C have received FEC-label mappings only from Switch B. Switch B has received FEC-label mappings from both Switch A and Switch C. Switch D does not receive FEC-label mappings from Switch A or Switch C. LDP has set up an LSP only over the link Switch A—Switch B—Switch C.

# Test the connectivity of the LDP LSP from Switch A to Switch C.

[SwitchA] ping mpls -a 11.1.1.1 ipv4 21.1.1.0 24
MPLS Ping FEC: 21.1.1.0/24 : 100 data bytes
100 bytes from 20.1.1.2: Sequence=1 time=1 ms
100 bytes from 20.1.1.2: Sequence=2 time=1 ms
100 bytes from 20.1.1.2: Sequence=3 time=8 ms
100 bytes from 20.1.1.2: Sequence=4 time=2 ms
100 bytes from 20.1.1.2: Sequence=5 time=1 ms

--- FEC: 21.1.1.0/24 ping statistics ---
5 packets transmitted, 5 packets received, 0.0% packet loss
round-trip min/avg/max = 1/2/8 ms

# Test the connectivity of the LDP LSP from Switch C to Switch A.

[SwitchC] ping mpls -a 21.1.1.1 ipv4 11.1.1.0 24
MPLS Ping FEC: 11.1.1.0/24 : 100 data bytes
100 bytes from 10.1.1.1: Sequence=1 time=1 ms
100 bytes from 10.1.1.1: Sequence=2 time=1 ms
100 bytes from 10.1.1.1: Sequence=3 time=1 ms
100 bytes from 10.1.1.1: Sequence=4 time=1 ms
100 bytes from 10.1.1.1: Sequence=5 time=1 ms

--- FEC: 11.1.1.0/24 ping statistics ---
5 packets transmitted, 5 packets received, 0.0% packet loss
round-trip min/avg/max = 1/1/1 ms