- Table of Contents
- Related Documents
-
Title | Size | Download |
---|---|---|
05-IP forwarding basics configuration | 82.21 KB |
Contents
Configuring IP forwarding basic settings························································ 1
About FIB table······························································································································· 1
Saving the IP forwarding entries to a file··························································································· 1
Display and maintenance commands for FIB table············································································ 2
Configuring load sharing··················································································· 3
About load sharing·························································································································· 3
Configuring per-packet or per-flow load sharing················································································ 3
Enabling bandwidth-based load sharing···························································································· 3
Display and maintenance commands for load sharing······································································· 4
Loading sharing configuration examples··························································································· 4
Example: Configuring load sharing based on source and destination addresses·························· 4
Configuring IP forwarding basic settings
About FIB table
A device uses the FIB table to make packet forwarding decisions.
A device selects optimal routes from the routing table, and puts them into the FIB table. Each FIB entry specifies the next hop IP address and output interface for packets destined for a specific subnet or host.
For more information about the routing table, see Layer 3—IP Routing Configuration Guide.
Use the display fib command to display the FIB table. The following example displays the entire FIB table.
<Sysname> display fib
Route destination count: 4
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
10.2.0.0/16 10.2.1.1 U GE1/0/12 Null
10.2.1.1/32 127.0.0.1 UH InLoop0 Null
127.0.0.0/8 127.0.0.1 U InLoop0 Null
127.0.0.1/32 127.0.0.1 UH InLoop0 Null
A FIB entry includes the following items:
· Destination—Destination IP address.
· Mask—Network mask. The mask and the destination address identify the destination network. A logical AND operation between the destination address and the network mask yields the address of the destination network. For example, if the destination address is 192.168.1.40 and the mask 255.255.255.0, the address of the destination network is 192.168.1.0. A network mask includes a certain number of consecutive 1s. It can be expressed in dotted decimal format or by the number of the 1s.
· Nexthop—IP address of the next hop.
· Flag—Route flag.
· OutInterface—Output interface.
· Token—Label Switched Path index number.
· Label—Inner label.
Saving the IP forwarding entries to a file
Restrictions and guidelines
The feature automatically creates the file if you specify a nonexistent file. If the file already exists, this feature overwrites the file content.
This feature triggers one-time saving of the IP forwarding entries.
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.
Procedure
To save the IP forwarding entries to a file, execute the following command in any view:
ip forwarding-table save filename filename
Display and maintenance commands for FIB table
Execute display commands in any view.
Task |
Command |
Display FIB entries. |
display fib [ topology topology-name | vpn-instance vpn-instance-name ] [ ip-address [ mask | mask-length ] ] |
Configuring load sharing
About load sharing
If a routing protocol finds multiple equal-cost best routes to the same destination, the device forwards packets over the equal-cost routes to implement load sharing.
Configuring per-packet or per-flow load sharing
About this task
In the per-flow load sharing mode, the device forwards flows over equal-cost routes. Packets of one flow travel along the same routes. You can configure the device to identify a flow based on the following criteria: source IP address, destination IP address, source port number, destination port number, and IP protocol number.
Procedure
1. Enter system view.
system-view
2. Configure load sharing.
ip load-sharing mode per-flow [ dest-ip | dest-port | ip-pro | src-ip | src-port ] * { global | slot slot-number }
By default, the device performs per-flow load sharing.
Enabling bandwidth-based load sharing
About this task
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 the interface expected bandwidth.
Devices that run load sharing protocols, such as Locator/ID Separation Protocol (LISP), implement load sharing based on the ratios defined by these protocols.
Procedure
1. Enter system view.
system-view
2. Enable IPv4 bandwidth-based load sharing.
bandwidth-based-sharing
By default, the IPv4 bandwidth-based load sharing is disabled.
3. (Optional.) Configure the expected bandwidth of the interface.
a. Enter interface view.
interface interface-type interface-number
b. Configure the expected bandwidth of the interface.
bandwidth bandwidth
By default, the expected bandwidth is the physical bandwidth of the interface.
Display and maintenance commands for load sharing
Execute display commands in any view.
Task |
Command |
Display the load sharing mode in use. |
display ip load-sharing mode slot slot-number |
Loading sharing configuration examples
Example: Configuring load sharing based on source and destination addresses
Network configuration
As shown in Figure 1, Router A has two equal-cost routes to Router B. Configure load sharing on Router A to forward packets through Router B to the destination IP address 1.2.3.4/24.
Procedure
# On Router A, configure IP addresses for GigabitEthernet 1/0/12 and GigabitEthernet 1/0/13.
<RouterA> system-view
[RouterA] interface gigabitethernet 1/0/12
[RouterA-GigabitEthernet1/0/12] ip address 10.1.1.1 24
[RouterA-GigabitEthernet1/0/12] quit
[RouterA] interface gigabitethernet 1/0/13
[RouterA-GigabitEthernet1/0/13] ip address 20.1.1.1 24
[RouterA-GigabitEthernet1/0/13] quit
# On Router B, configure IP addresses for GigabitEthernet 1/0/12 and GigabitEthernet 1/0/13.
<RouterB> system-view
[RouterB] interface gigabitethernet 1/0/12
[RouterB-GigabitEthernet1/0/12] ip address 10.1.1.2 24
[RouterB-GigabitEthernet1/0/12] quit
[RouterB] interface gigabitethernet 1/0/13
[RouterB-GigabitEthernet1/0/13] ip address 20.1.1.2 24
[RouterB-GigabitEthernet1/0/13] quit
# On Router A, configure two static routes to the destination IP address.
[RouterA] ip route-static 1.2.3.4 24 10.1.1.2
[RouterA] ip route-static 1.2.3.4 24 20.1.1.2
[RouterA] quit
# On Router A, display FIB entries matching the destination IP address 1.2.3.4.
<RouterA> display fib 1.2.3.4
FIB entry count: 2
Flag:
U:Usable G:Gateway H:Host B:Blackhole D:Dynamic S:Static
R:Relay F:FRR
Destination/Mask Nexthop Flag OutInterface/Token Label
1.2.3.0/24 10.1.1.2 USGR GE1/0/12 Null
1.2.3.0/24 20.1.1.2 USGR GE1/0/13 Null
# On Router A, configure per-flow load sharing based on the source IP address and destination IP address.
<RouterA> system-view
[RouterA] ip load-sharing mode per-flow dest-ip src-ip global
[RouterA] quit
Verifying the configuration
# Verify that Router A implements load sharing.
<RouterA> display counters outbound interface GigabitEthernet
Interface Total (pkts) Broadcast (pkts) Multicast (pkts) Err (pkts)
GE1/0/12 1045 0 0 0
GE1/0/13 1044 0 0 0