- Table of Contents
-
- 05-Layer 3—IP Services Command Reference
- 00-Preface
- 01-ARP commands
- 02-IP addressing commands
- 03-DNS commands
- 04-mDNS relay commands
- 05-IP forwarding basics commands
- 06-Fast forwarding commands
- 07-Adjacency table commands
- 08-IRDP commands
- 09-IP performance optimization commands
- 10-UDP helper commands
- 11-IPv6 basics commands
- 12-IPv6 fast forwarding commands
- 13-AFT commands
- 14-Tunneling commands
- 15-GRE commands
- 16-HTTP redirect commands
- Related Documents
-
Title | Size | Download |
---|---|---|
05-IP forwarding basics commands | 126.02 KB |
Basic IP forwarding commands
display fib
Use display fib to display FIB entries.
Syntax
display fib | vpn-instance vpn-instance-name ] [ ip-address [ mask | mask-length ] ] [ slot slot-number ]
Views
Any view
Predefined user roles
network-admin
network-operator
Parameters
vpn-instance vpn-instance-name: Specifies an MPLS L3VPN instance by its name, a case-sensitive string of 1 to 31 characters. To display the FIB entries for the public network, do not specify any VPN instance.
ip-address: Displays the FIB entry that matches the specified destination IP address.
mask: Specifies the mask for the IP address.
mask-length: Specifies the mask length for the IP address. The value range is 0 to 32.
slot slot-number: Specifies a card by its slot number. If you do not specify a card, this command displays FIB entries on all cards.
Usage guidelines
If you specify an IP address without a mask or mask length, this command displays the longest matching FIB entry.
If you specify an IP address and a mask or mask length, this command displays the exactly matching FIB entry.
Examples
# Display all FIB entries of the public network.
<Sysname> display fib
Route destination count: 5
Directly-connected host count: 0
Flag:
U:Usable G:Gateway H:Host B:Blackhole D:Dynamic S:Static
R:Relay F:FRR
Destination/Mask Nexthop Flag OutInterface/Token Label
0.0.0.0/32 127.0.0.1 UH InLoop0 Null
1.1.1.0/24 192.168.126.1 USGF MGE0/0/0 Null
127.0.0.0/8 127.0.0.1 U InLoop0 Null
127.0.0.0/32 127.0.0.1 UH InLoop0 Null
127.0.0.1/32 127.0.0.1 UH InLoop0 Null
# Display the FIB entries for VPN vpn1.
<Sysname> display fib vpn-instance vpn1
Route destination count: 6
Directly-connected host count: 0
Flag:
U:Usable G:Gateway H:Host B:Blackhole D:Dynamic S:Static
R:Relay F:FRR
Destination/Mask Nexthop Flag OutInterface/Token Label
0.0.0.0/32 127.0.0.1 UH InLoop0 Null
20.20.20.0/24 20.20.20.25 U MGE0/0/0 Null
20.20.20.0/32 20.20.20.25 UBH MGE0/0/0 Null
20.20.20.25/32 127.0.0.1 UH InLoop0 Null
20.20.20.255/32 20.20.20.25 UBH MGE0/0/0 Null
20.20.20.255/32 2001::1 UBH MGE0/0/0 Null
# Display the FIB entries matching the destination IP address 10.2.1.1.
<Sysname> display fib 10.2.1.1
FIB entry count: 1
Flag:
U:Usable G:Gateway H:Host B:Blackhole D:Dynamic S:Static
R:Relay F:FRR
Destination/Mask Nexthop Flag OutInterface/Token Label
10.2.1.1/32 127.0.0.1 UH InLoop0 Null
Table 1 Command output
Field |
Description |
Route destination count |
Number of route destination addresses. |
Directly-connected host count |
Number of directly-connected hosts that are learned through features such as ARP. |
FIB entry count |
Total number of FIB entries. |
Destination/Mask |
Destination address and the mask length. |
Nexthop |
Next hop address. |
Flag |
Flags of routes: · U—Usable route. · G—Gateway route. · H—Host route. · B—Blackhole route. · D—Dynamic route. · S—Static route. · R—Relay route. · F—Fast reroute. |
OutInterface/Token |
Output interface/LSP index number. |
Label |
Inner label. |
display fib count
Use display fib count to display FIB entry statistics.
Syntax
display fib count [ all | vpn-instance vpn-instance-name ] slot slot-number
Views
Any view
Predefined user roles
network-admin
network-operator
Parameters
all: Displays FIB entry statistics for the public network and all VPN instances.
vpn-instance vpn-instance-name: Specifies an MPLS L3VPN instance by its name, a case-sensitive string of 1 to 31 characters.
slot slot-number: Specifies a card by its slot number.
Usage guidelines
If you do not specify the all or vpn-instance keyword, this command displays FIB entry statistics for the public network.
Examples
# Display FIB entry statistics for the public network and all VPN instances on slot 1.
<Sysname> system-view
[Sysname] display fib count all slot 10
Total count: 3121
Route destination count: 6
Directly-connected host count: 0
VPN-Instance Name Route destination count Directly-connected host count
1 100 3
vpn1 1000 10
vpn2 2000 2
# Display FIB entry statistics for the public network on slot 1.
<Sysname> system-view
[Sysname] display fib count slot 10
Route destination count: 6
Directly-connected host count: 0
Table 2 Command output
Field |
Description |
Route destination count |
Number of route destination addresses. |
Directly-connected host count |
Number of directly-connected hosts that are learned through features such as ARP. |
Total count |
Number of FIB entries. |
VPN-Instance Name |
VPN instance name. |
fib log enable
Use fib log enable to enable FIB logging.
Use undo fib log enable to disable FIB logging.
Syntax
fib log enable
undo fib log enable
Default
FIB logging is disabled.
Views
System view
Predefined user roles
network-admin
Usage guidelines
The logs are sent to the information center of the device. For the logs to be output correctly, you must also configure the information center on the device. For more information about information center configuration, see Network Management and Monitoring Configuration Guide.
To avoid memory consumption caused by log recording, you can use the undo fib log enable command to disable FIB logging.
Examples
# Enable FIB logging.
<Sysname> system-view
[Sysname] fib log enable
fib max-number
Use fib max-number to specify the maximum number of FIB entries on an interface module.
Use undo fib max-number to restore the default.
Syntax
fib max-number max-number slot slot-number
undo fib max-number
Default
The maximum number of FIB entries on an interface module is the maximum number of FIB entries supported by the device.
Views
System view
Predefined user roles
network-admin
Parameters
max-number: Specifies the maximum number of IPv4 FIB entries on an interface module, in the range of 0 to 4294967295.
slot slot-number: Specifies an interface module by its slot number.
Usage guidelines
To save memory resources, you can use this command to decrease the maximum number of FIB entries on an interface module.
If the value for the max-number argument exceeds the maximum number supported by the device, the configuration does not take effect on interface modules. The maximum number supported by the device is then applied to the interface modules.
If the number of FIB entries has reached max-number on an interface module, the module stops accepting new FIB entries issued by the MPU. The existing services on the module are not affected. If the MPU deletes some old FIB entries and notifies the interface module to delete the entries, the interface module can accept new FIB entries until the upper limit is reached again.
Examples
# Specify the maximum number of FIB entries on the interface module in slot 10 as 1000.
<Sysname> system-view
[Sysname] fib max-number 1000 slot 10
fib smooth
Use fib smooth to perform one-time FIB entry synchronization.
Syntax
fib smooth slot slot-number
Views
System view
Predefined user roles
network-admin
Parameters
slot slot-number: Specifies a card by its slot number.
Usage guidelines
Perform this task to synchronize FIB entries from the MPU to the specified interface module.
If the maximum number of IPv4 or IPv6 FIB entries (specified by using the fib max-number or ipv6 fib max-number command) is reached on the interface module, the module stops accepting new entries.
Examples
# Perform one-time FIB entry synchronization.
<Sysname> system-view
[Sysname] fib smooth slot 10
Related commands
fib max-number
ipv6 fib max-number
fib switch-enhance
Use fib switch-enhance to enable FIB route switching optimization.
Use undo fib switch-enhance to restore the default.
Syntax
fib switch-enhance
undo fib switch-enhance
Default
FIB route switching optimization is disabled.
Views
System view
Predefined user roles
network-admin
Usage guidelines
This feature is applicable to scenarios with high service traffic sustainability requirements. It enables the device to keep using the current route until the new route becomes available, instead of disconnecting the current route directly. This prevents packet loss caused by route switch, which might take hundreds of milliseconds.
The device can keep using the current route for a maximum of 10 seconds.
Examples
# Enable FIB route switching optimization.
<Sysname> system-view
[Sysname] fib switch-enhance
ip forwarding
Use ip forwarding to enable IPv4 packet forwarding on an interface that has no IPv4 address configured.
Use undo ip forwarding to disable IPv4 packet forwarding on an interface that has no IPv4 address configured.
Syntax
ip forwarding
undo ip forwarding
Default
If an interface has no IPv4 address configured, it cannot forward IPv4 packets.
Views
Interface view
Predefined user roles
network-admin
Usage guidelines
On a device that supports both IPv4 and IPv6, the next hop of an IPv4 packet might be an IPv4 address or an IPv6 address. If the output interface has no IPv4 address configured, the interface cannot forward the IPv4 packet. To solve this problem, execute this command on the interface. This feature allows the interface to forward IPv4 packets even though the interface has no IPv4 address configured.
Examples
# Enable IPv4 packet forwarding on Ten-GigabitEthernet 3/0/1 that has no IPv4 address configured.
<Sysname> system-view
[Sysname] interface ten-gigabitethernet 3/0/1
[Sysname-Ten-GigabitEthernet3/0/1] ip forwarding
# Enable IPv4 packet forwarding on VLAN-interface 1 that has no IPv4 address configured.
<Sysname> system-view
[Sysname] interface vlan-interface 1
[Sysname-Vlan-interface1] ip forwarding
ip forwarding-table save
Use ip forwarding-table save to save the IP forwarding entries to a file.
Syntax
ip forwarding-table save filename filename
Views
Any view
Predefined user roles
network-admin
Parameters
filename filename: Specifies the name of a file, a string of 1 to 255 characters. For information about the filename argument, see Fundamentals Configuration Guide.
Usage guidelines
The command automatically creates the file if you specify a nonexistent file. If the file already exists, this command overwrites the file content.
To automatically save the IP forwarding entries periodically, configure a schedule for the device to automatically run the ip forwarding-table save command. For information about scheduling a task, see Fundamentals Configuration Guide.
Examples
# Save the IP forwarding entries to the fib.txt file.
<Sysname> ip forwarding-table save filename fib.txt
ipv6 forwarding
Use ipv6 forwarding to enable IPv6 packet forwarding on an interface that has no IPv6 address configured.
Use undo ipv6 forwarding to disable IPv6 packet forwarding on an interface that has no IPv6 address configured.
Syntax
ipv6 forwarding
undo ipv6 forwarding
Default
If an interface has no IPv6 address configured, it cannot forward IPv6 packets.
Views
Interface view
Predefined user roles
network-admin
Usage guidelines
On a device that supports both IPv4 and IPv6, the next hop of an IPv6 packet might be an IPv4 address or an IPv6 address. If the output interface has no IPv6 address configured, the interface cannot forward the IPv6 packet. To solve this problem, execute this command on the interface. This feature allows the interface to forward IPv6 packets even though the interface has no IPv6 address configured.
Examples
# Enable IPv6 packet forwarding on Ten-GigabitEthernet 3/0/1 that has no IPv6 address configured.
<Sysname> system-view
[Sysname] interface ten-gigabitethernet 3/0/1
[Sysname-Ten-GigabitEthernet3/0/1] ipv6 forwarding
# Enable IPv6 packet forwarding on VLAN-interface 1 that has no IPv6 address configured.
<Sysname> system-view
[Sysname] interface vlan-interface 1
[Sysname-Vlan-interface1] ipv6 forwarding
snmp-agent trap enable fib
Use snmp-agent trap enable fib to enable SNMP notifications for FIB events.
Use undo snmp-agent trap enable fib to disable SNMP notifications for FIB events.
Syntax
snmp-agent trap enable fib
undo snmp-agent trap enable fib
Default
SNMP notifications for FIB events are enabled.
Views
System view
Predefined user roles
network-admin
Usage guidelines
This feature enables the FIB module to generate SNMP notifications for critical FIB events. The SNMP notifications are sent to the SNMP module. For the SNMP notifications to be sent correctly, you must also configure SNMP. For more information about SNMP configuration, see Network Management and Monitoring Configuration Guide.
Examples
# Disable SNMP notifications for FIB events.
<Sysname> system-view
[Sysname] undo snmp-agent trap enable fib
snmp-agent trap enable ip-forwarding
Use snmp-agent trap enable ip-forwarding to enable SNMP notifications for IP forwarding events.
Use undo snmp-agent trap enable ip-forwarding to disable SNMP notifications for IP forwarding events.
Syntax
snmp-agent trap enable ip-forwarding
undo snmp-agent trap enable ip-forwarding
Default
SNMP notifications for IP forwarding events are enabled.
Views
System view
Predefined user roles
network-admin
Usage guidelines
This feature enables the IP forwarding module to generate SNMP notifications for critical IP forwarding events. The SNMP notifications are sent to the SNMP module. For the SNMP notifications to be sent correctly, you must also configure SNMP. For more information about SNMP configuration, see Network Management and Monitoring Configuration Guide.
Examples
# Disable SNMP notifications for IP forwarding events.
<Sysname> system-view
[Sysname] undo snmp-agent trap enable ip-forwarding
Load sharing commands
bandwidth-based-sharing
Use bandwidth-based-sharing to enable IPv4 load sharing based on bandwidth.
Use undo bandwidth-based-sharing to disable IPv4 load sharing based on bandwidth.
Syntax
bandwidth-based-sharing
undo bandwidth-based-sharing
Default
The IPv4 load sharing based on bandwidth is disabled.
Views
System view
Predefined user roles
network-admin
Usage guidelines
This feature load shares flow traffic among multiple output interfaces based on their load percentages. The device calculates the load percentage for each output interface in terms of their expected bandwidths.
Devices that run load sharing protocols, such as Locator/ID Separation Protocol (LISP), implement load sharing based on the ratios defined by these protocols.
Examples
# Enable IPv4 load sharing based on bandwidth.
<Sysname> system-view
[Sysname] bandwidth-based-sharing
display ip load-sharing mode
Use display ip load-sharing mode to display the load sharing mode in use.
Syntax
display ip load-sharing mode slot slot-number
Views
Any view
Predefined user roles
network-admin
network-operator
Parameters
slot slot-number: Specifies a card by its slot number. If you do not specify a card, this command displays the load sharing mode for all cards.
Examples
# Display the load sharing mode in use.
<Sysname> display ip load-sharing mode slot 10
Load-sharing mode: per-flow
Load-sharing options: dest-ip | src-ip | ip-pro | dest-port | src-port | dest-mac | src-mac | ingress-port
Load-sharing algorithm: 1
IP tunnel load-sharing mode: outer
Table 3 Command output
Field |
Description |
Load-sharing mode |
The load sharing mode in use: · per-packet—Per-packet load sharing. · per-flow—Per-flow load sharing. |
Load-sharing options |
Options configured for load sharing: · dest-ip—Identifies flows by packet's destination IP address. · src-ip—Identifies flows by packet's source IP address. · ip-pro—Identifies flows by packet's IP protocol. · dest-port—Identifies flows by packet's destination port number. · src-port—Identifies flows by packet's source port number. · ingress-port—Identifies flows by packet's ingress port. · dest-mac—Identifies flows by packet's destination MAC address. · src-mac—Identifies flows by packet's source MAC address. |
Load-sharing algorithm |
Algorithm used by load sharing. |
IP tunnel load-sharing mode |
Load sharing for IP tunnel packets: · all—Identifies flows by inner and outer IP header information. · inner—Identifies flows by inner IP header information. · outer—Identifies flows by outer IP header information. |
Related commands
ip load-sharing mode
ip load-sharing mode
Use ip load-sharing mode to configure the load sharing mode.
Use undo ip load-sharing mode to restore the default.
Syntax
ip load-sharing mode { per-flow [ algorithm algorithm-number | | [ dest-ip | dest-mac | dest-port | ip-pro | src-ip | src-mac | src-port ] * |per-packet } { global | slot slot-number }
undo ip load-sharing mode [ per-flow { algorithm | tunnel } ] { global | slot slot-number }
Default
The device implements per-flow load sharing.
Table 4 shows the default load sharing modes.
Table 4 Default load sharing modes
Packet type |
Default load sharing modes |
IP unicast packets |
dest-ip, src-ip, dest-port, src-port |
IP multicast packets |
dest-ip, src-ip, dest-port, src-port |
Layer 2 frames |
dest-mac, src-mac |
MPLS L3VPN packets |
dest-ip, src-ip, dest-port, src-port |
MPLS L2VPN packets |
· IP packets: dest-ip, src-ip, dest-port, src-port · Other packets: dest-mac, src-mac |
MPLS LSPs |
· IP packets: mpls-label1, mpls-label2, dest-ip, src-ip, dest-port, src-port · Other packets: mpls-label1, mpls-label2, dest-mac, src-mac |
Other MPLS packets |
mpls-label1, mpls-label2 |
IP tunnel packets |
· IP packets: inner dest-ip, inner src-ip, inner src-port, inner dest-port · Non-termination MPLS packets: mpls-label1, mpls-label2 |
Views
System view
Predefined user roles
network-admin
Parameters
per-flow: Implements per-flow load sharing. If you specify none of the destination IP address, destination MAC address, destination port number, protocol number, source IP address, source MAC address, and source port number, the device performs per-flow load sharing based on the destination IP address and the source IP address of the packets.
algorithm algorithm-number: Specifies an algorithm for per-flow load sharing. The value range for the algorithm-number argument is 0 to 9. If you do not specify an algorithm, the default algorithm value is 0. If you specify an algorithm and then execute the undo ip load-sharing mode command, the algorithm value is set to 0.
dest-ip: Identifies flows by destination IP address.
dest-mac: Identifies flows by destination MAC address.
dest-port: Identifies flows by destination port.
global: Configures the load sharing mode globally.
ip-pro: Identifies flows by protocol number.
src-ip: Identifies flows by source IP address.
src-mac: Identifies flows by source MAC address.
src-port: Identifies flows by source port.
per-packet: Implements per-packet load sharing.
slot slot-number: Specifies a card by its slot number. If you do not specify a card, this command configures the load sharing mode for all cards.
Restrictions and guidelines
The ip-pro keyword is not supported on the device.
On the device, the per-flow load sharing modes take effect in the following order:
1. Algorithm-based per-flow load sharing configured globally or on the specified card (specified by the algorithm algorithm-number option).
2. Per-flow load sharing with a random combination of the dest-ip, dest-mac, dest-port, src-ip, src-mac, and src-port keywords on the specified card.
3. Global per-flow load sharing with a random combination of the dest-ip, dest-mac, dest-port, src-ip, src-mac, and src-port keywords.
4. Global default load sharing mode.
Examples
# Configure per-packet load sharing on slot 1.
<Sysname> system-view
[Sysname] ip load-sharing mode per-packet slot 10
# Configure per-flow load sharing by destination IP address and source IP address on slot 1.
<Sysname> system-view
[Sysname] ip load-sharing mode per-flow dest-ip src-ip slot 10
# Specify algorithm 1 for per-flow load sharing on slot 1.
<Sysname> system-view
[Sysname] ip load-sharing mode per-flow algorithm 1 slot 10