Example for Configuring an LDP Inbound Policy
Networking Requirements
On a network shown in Figure 3-34, MPLS LDP is deployed. LSRD functions as the access device and has low performance. If the number of received labels on LSRD is not controlled, numerous LSPs are established, which occupy memory resources and overload LSRD. The number of LSPs needs to be reduced to save LSRD memory resources.
Configuration Roadmap
To meet the preceding requirements, configure an LDP inbound policy. The configuration roadmap is as follows:
Configure the LDP inbound policy on LSRD so that LSRD receives only Label Mapping messages that are sent from LSRB and carry the routes to LSRC.
Procedure
- Configure IP addresses for interfaces.
# Configure LSRA. The configurations of LSRB, LSRC, and LSRD are similar to the configuration of LSRA, and are not mentioned here.
<Huawei> system-view [Huawei] sysname LSRA [LSRA] interface loopback 1 [LSRA-LoopBack1] ip address 10.10.1.1 32 [LSRA-LoopBack1] quit [LSRA] interface gigabitethernet 1/0/0 [LSRA-GigabitEthernet1/0/0] ip address 10.1.1.1 24 [LSRA-GigabitEthernet1/0/0] quit
- Configure OSPF to advertise the network segments connecting
to interfaces on each node and to advertise the routes of hosts with
LSR IDs.
# Configure LSRA. The configurations of LSRB, LSRC, and LSRD are similar to the configuration of LSRA, and are not mentioned here.
[LSRA] ospf 1 [LSRA-ospf-1] area 0 [LSRA-ospf-1-area-0.0.0.0] network 10.10.1.1 0.0.0.0 [LSRA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255 [LSRA-ospf-1-area-0.0.0.0] quit [LSRA-ospf-1] quit
- Enable MPLS globally and on an interface, and MPLS LDP
on each node.
# Configure LSRA.
[LSRA] mpls lsr-id 10.10.1.1 [LSRA] mpls [LSRA-mpls] quit [LSRA] mpls ldp [LSRA-mpls-ldp] quit [LSRA] interface gigabitethernet 1/0/0 [LSRA-GigabitEthernet1/0/0] mpls [LSRA-GigabitEthernet1/0/0] mpls ldp [LSRA-GigabitEthernet1/0/0] quit
# Configure LSRB.
[LSRB] mpls lsr-id 10.10.1.2 [LSRB] mpls [LSRB-mpls] quit [LSRB] mpls ldp [LSRB-mpls-ldp] quit [LSRB] interface gigabitethernet 1/0/0 [LSRB-GigabitEthernet1/0/0] mpls [LSRB-GigabitEthernet1/0/0] mpls ldp [LSRB-GigabitEthernet1/0/0] quit [LSRB] interface gigabitethernet 1/0/1 [LSRB-GigabitEthernet1/0/1] mpls [LSRB-GigabitEthernet1/0/1] mpls ldp [LSRB-GigabitEthernet1/0/1] quit [LSRB] interface gigabitethernet 1/0/2 [LSRB-GigabitEthernet1/0/2] mpls [LSRB-GigabitEthernet1/0/2] mpls ldp [LSRB-GigabitEthernet1/0/2] quit
# Configure LSRC.
[LSRC] mpls lsr-id 10.10.1.3 [LSRC] mpls [LSRC-mpls] quit [LSRC] mpls ldp [LSRC-mpls-ldp] quit [LSRC] interface gigabitethernet 1/0/0 [LSRC-GigabitEthernet1/0/0] mpls [LSRC-GigabitEthernet1/0/0] mpls ldp [LSRC-GigabitEthernet1/0/0] quit
# Configure LSRD.
[LSRD] mpls lsr-id 10.10.1.4 [LSRD] mpls [LSRD-mpls] quit [LSRD] mpls ldp [LSRD-mpls-ldp] quit [LSRD] interface gigabitethernet 1/0/0 [LSRD-GigabitEthernet1/0/0] mpls [LSRD-GigabitEthernet1/0/0] mpls ldp [LSRD-GigabitEthernet1/0/0] quit
# When the configurations are complete, run the display mpls lsp command on LSRD to view the established LSP.
[LSRD] display mpls lsp ------------------------------------------------------------------------------- LSP Information: LDP LSP ------------------------------------------------------------------------------- FEC In/Out Label In/Out IF Vrf Name 10.10.1.1/32 NULL/1024 -/GE1/0/0 10.10.1.1/32 1024/1024 -/GE1/0/0 10.10.1.2/32 NULL/3 -/GE1/0/0 10.10.1.2/32 1025/3 -/GE1/0/0 10.10.1.3/32 NULL/1025 -/GE1/0/0 10.10.1.3/32 1026/1025 -/GE1/0/0 10.10.1.4/32 3/NULL -/-
The command output shows that the LSPs from LSRD to LSRA, LSRB, and LSRC are established.
- Configure an LDP inbound policy.
# Configure an IP prefix list on LSRD to allow only routes to LSRC to pass.
[LSRD] ip ip-prefix prefix1 permit 10.10.1.3 32
# Configure the LDP inbound policy on LSRD so that LSRC accepts only Label Mapping messages from LSRD.
[LSRD] mpls ldp [LSRD-mpls-ldp] inbound peer 10.10.1.2 fec ip-prefix prefix1 [LSRD-mpls-ldp] quit
- Verify the configuration.
# Run the display mpls lsp command on LSRD to view the established LSP to LSRC.
[LSRD] display mpls lsp ------------------------------------------------------------------------------- LSP Information: LDP LSP ------------------------------------------------------------------------------- FEC In/Out Label In/Out IF Vrf Name 10.10.1.3/32 NULL/1025 -/GE1/0/0 10.10.1.3/32 1026/1025 -/GE1/0/0 10.10.1.4/32 3/NULL -/-
Configuration Files
LSRA configuration file
# sysname LSRA # mpls lsr-id 10.10.1.1 mpls # mpls ldp # interface GigabitEthernet1/0/0 ip address 10.1.1.1 255.255.255.0 mpls mpls ldp # interface LoopBack1 ip address 10.10.1.1 255.255.255.255 # ospf 1 area 0.0.0.0 network 10.10.1.1 0.0.0.0 network 10.1.1.0 0.0.0.255 # return
LSRB configuration file
# sysname LSRB # mpls lsr-id 10.10.1.2 mpls # mpls ldp # interface GigabitEthernet1/0/0 ip address 10.1.1.2 255.255.255.0 mpls mpls ldp # interface GigabitEthernet1/0/1 ip address 10.1.2.1 255.255.255.0 mpls mpls ldp # interface GigabitEthernet1/0/2 ip address 10.1.3.2 255.255.255.0 mpls mpls ldp # interface LoopBack1 ip address 10.10.1.2 255.255.255.255 # ospf 1 area 0.0.0.0 network 10.10.1.2 0.0.0.0 network 10.1.1.0 0.0.0.255 network 10.1.2.0 0.0.0.255 network 10.1.3.0 0.0.0.255 # return
LSRC configuration file
# sysname LSRC # mpls lsr-id 10.10.1.3 mpls # mpls ldp # interface GigabitEthernet1/0/0 ip address 10.1.2.2 255.255.255.0 mpls mpls ldp # interface LoopBack1 ip address 10.10.1.3 255.255.255.255 # ospf 1 area 0.0.0.0 network 10.10.1.3 0.0.0.0 network 10.1.2.0 0.0.0.255 # return
LSRD configuration file
# sysname LSRD # mpls lsr-id 10.10.1.4 mpls # mpls ldp inbound peer 10.10.1.2 fec ip-prefix prefix1 # interface GigabitEthernet1/0/0 ip address 10.1.3.1 255.255.255.0 mpls mpls ldp # interface LoopBack1 ip address 10.10.1.4 255.255.255.255 # ospf 1 area 0.0.0.0 network 10.10.1.4 0.0.0.0 network 10.1.3.0 0.0.0.255 # ip ip-prefix prefix1 index 10 permit 10.10.1.3 32 # return