Example: Configuring load sharing based on source and destination addresses

Network configuration

As shown in Figure 54, Switch A has two equal-cost routes to Switch B. Configure load sharing on Switch A to forward packets through Switch B to the destination IP address 1.2.3.4/24.

Figure 54: Network diagram

Procedure


[IMPORTANT: ]

IMPORTANT:

By default, interfaces on the device are disabled (in ADM or Administratively Down state). To have an interface operate, you must use the undo shutdown command to enable that interface.


# On Switch A, assign Ten-GigabitEthernet 1/0/1 to VLAN 10, and Ten-GigabitEthernet 1/0/2 to VLAN 20.

<SwitchA> system-view
[SwitchA] vlan 10
[SwitchA-vlan10] port ten-gigabitethernet 1/0/1
[SwitchA-vlan10] quit
[SwitchA] vlan 20
[SwitchA-vlan20] port ten-gigabitethernet 1/0/2
[SwitchA-vlan20] quit

# On Switch A, configure IP addresses for VLAN-interface 10 and VLAN-interface 20.

[SwitchA] interface vlan-interface 10
[SwitchA-Vlan-interface10] ip address 10.1.1.1 24
[SwitchA-Vlan-interface10] quit
[SwitchA] interface vlan-interface 20
[SwitchA-Vlan-interface20] ip address 20.1.1.1 24
[SwitchA-Vlan-interface20] quit

# On Switch B, assign Ten-GigabitEthernet 1/0/1 to VLAN 10, and Ten-GigabitEthernet 1/0/2 to VLAN 20.

<SwitchB> system-view
[SwitchB] vlan 10
[SwitchB-vlan10] port ten-gigabitethernet 1/0/1
[SwitchB-vlan10] quit
[SwitchB] vlan 20
[SwitchB-vlan20] port ten-gigabitethernet 1/0/2
[SwitchB-vlan20] quit

# On Switch B, configure IP addresses for VLAN-interface 10 and VLAN-interface 20.

[SwitchB] interface vlan-interface 10
[SwitchB-Vlan-interface10] ip address 10.1.1.2 24
[SwitchB-Vlan-interface10] quit
[SwitchB] interface vlan-interface 20
[SwitchB-Vlan-interface20] ip address 20.1.1.2 24
[SwitchB-Vlan-interface20] quit

# On Switch A, configure two static routes to the destination IP address.

<SwitchA> system-view
[SwitchA] ip route-static 1.2.3.4 24 10.1.1.2
[SwitchA] ip route-static 1.2.3.4 24 20.1.1.2
[SwitchA] quit

# On Switch A, display FIB entries matching the destination IP address 1.2.3.4.

<SwitchA> display fib 1.2.3.4
Destination count: 1 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     Vlan10                   Null
1.2.3.0/24         20.1.1.2        USGR     Vlan20                   Null

# On Switch A, configure per-flow load sharing based on the source IP address and destination IP address.

<SwitchA> system-view
[SwitchA] ip load-sharing mode per-flow dest-ip src-ip global

Verifying the configuration

# Verify that Switch A implements load sharing.

<SwitchA> display counters outbound interface Ten-GigabitEthernet
Interface         Total (pkts)   Broadcast (pkts)   Multicast (pkts)  Err (pkts)
XGE1/0/1                 1045                  0                  0           0
XGE1/0/2                 1044                  0                  0           0