- Table of Contents
-
- 04-Layer 3—IP Services Command Reference
- 00-Preface
- 01-ARP commands
- 02-IP addressing commands
- 03-DHCP commands
- 04-DNS 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-DHCPv6 commands
- 13-IPv6 fast forwarding commands
- 14-Tunneling commands
- 15-HTTP redirect commands
- Related Documents
-
Title | Size | Download |
---|---|---|
05-IP forwarding basics commands | 69.43 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 ] ]
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.
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
Destination count: 5 FIB entry count: 5
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 M-GE0/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
Destination count: 6 FIB entry count: 6
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 M-GE0/0/0 Null
20.20.20.0/32 20.20.20.25 UBH M-GE0/0/0 Null
20.20.20.25/32 127.0.0.1 UH InLoop0 Null
20.20.20.25/32 20.20.20.25 H M-GE0/0/0 Null
20.20.20.255/32 20.20.20.25 UBH M-GE0/0/0 Null
# Display the FIB entries matching the destination IP address 10.2.1.1.
<Sysname> display fib 10.2.1.1
Destination count: 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 |
Destination count |
Total number of destination addresses. |
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. |
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, the IPv4 packet forwarding is disabled on the interface.
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 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 file system management in 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
Load sharing commands
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 an IRF member device by its member ID. If you do not specify a member device, this command displays the load sharing mode for all member devices.
Examples
# Display the load sharing mode in use.
<Sysname> display ip load-sharing mode slot 1
Load-sharing mode: per-flow
Load-sharing options: dest-ip | src-ip | ip-pro | dest-port | src-port | ingress-port
Load-sharing algorithm: 1
IP tunnel load-sharing mode: outer
Table 2 Command output
Field |
Description |
Load-sharing mode |
The load sharing mode in use: 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. |
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 local-first enable
Use ip load-sharing local-first enable to enable local-first load sharing.
Use undo ip load-sharing local-first enable to disable local-first load sharing.
Syntax
ip load-sharing local-first enable
undo ip load-sharing local-first enable
Default
Local-first load sharing is enabled.
Views
System view
Predefined user roles
network-admin
Usage guidelines
Local-first load sharing takes effect only on an IRF fabric.
Examples
# Enable local-first load sharing.
<Sysname> system-view
[Sysname] ip load-sharing local-first enable
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 [ seed seed-number ] [ shift shift-number ] | [ dest-ip | dest-port | ingress-port | ip-pro | src-ip | src-port ] * | tunnel { inner | outer } ] } { global | slot slot-number }
undo ip load-sharing mode [ per-flow tunnel ] { global | slot slot-number }
Default
The device performs per-flow load sharing based on the following criteria: source IP address, destination IP address, source port number, destination port number, IP protocol number, and ingress port.
Views
System view
Predefined user roles
network-admin
Parameters
algorithm algorithm-number: Specifies an algorithm for per-flow load sharing. The value range for the algorithm-number argument is 0 to 13.If you do not specify an algorithm, the algorithm value is set to 0.
seed seed-number: Specifies the seed value for the algorithm. The value range is 0 to ffffffff, and the default value is 0.
shift shift-number: Specifies the shift value for the hash algorithm result. The value range is 0 to 31 and the default value is 0.
per-flow: Implements per-flow load sharing. If you specify none of the dest-ip, dest-port, ingress-port, ip-pro, src-ip, and src-port keywords, the device performs per-flow load sharing based on the destination IP addresses and source IP addresses of packets.
dest-ip: Identifies flows by destination IP address.
dest-port: Identifies flows by destination port.
ingress-port: Identifies flows by ingress port.
ip-pro: Identifies flows by protocol number.
src-ip: Identifies flows by source IP address.
src-port: Identifies flows by source port.
tunnel { inner | outer }: Performs per-flow load sharing for IP tunnel packets. The inner keyword identifies flows by inner IP header information. The outer keyword identifies flows by outer IP header information. If you do not specify this option, the device performs per-flow load sharing based on outer IP header information.
global: Configures the load sharing mode globally.
slot slot-number: Specifies an IRF member device by its member ID. If you do not specify a member device, this command configures the load sharing mode for all member devices.
Usage guidelines
If traffic is not shared equally, you can use the seed seed-number option and the shift shift-number option to adjust the algorithm result.
Examples
# Configure per-flow load sharing for slot 1.
<Sysname> system-view
[Sysname] ip load-sharing mode per-flow slot 1
# Configure per-flow load sharing based on the destination IP addresses and source IP addresses of packets for slot 1.
<Sysname> system-view
[Sysname] ip load-sharing mode per-flow dest-ip src-ip slot 1
# Configure per-flow load sharing based on the inner IP header information of IP tunnel packets for slot 1.
<Sysname> system-view
[Sysname] ip load-sharing mode per-flow tunnel inner slot 1
# Configure per-flow load sharing based on algorithm 1 for slot 1.
<Sysname> system-view
[Sysname] ip load-sharing mode per-flow algorithm 1 slot 1
Related commands
display ip load-sharing mode