Cisco configuration newbie - OSPF load balancing
- Spoto
- |
- Posted on: 2019-05-10
- |
- Views: 2992
Introduction to OSPF load sharing
Equal-Cost Multiple Path (ECMP) means that when multiple paths exist between two network nodes, traffic between nodes is evenly distributed among multiple paths. The role of load sharing is to reduce the traffic pressure of each path and enhance network robustness. When multiple routes discovered by the same routing protocol exist in the same destination, and the cost values of the routes are the same, the load balancing condition is satisfied. When load balancing is implemented, the router forwards according to the quintuple (source address, destination address, source port, destination port, protocol). When the quintuple is the same, the router always selects the same next hop address as the last time. Message. When the quintuple is different, the router will select a relatively idle path for forwarding.
On an OSPF network, sometimes there are multiple equal-cost paths between two NEs, and it is difficult for a single path to bear all traffic. In this case, users generally want to distribute all traffic on average. You can improve the reliability of the network and improve the utilization of resources. In this case, you can consider configuring OSPF load balancing.
Configuration considerations
Use the maximum load-balancing command to configure the maximum number of equal-cost routes for load balancing.
If you need to cancel load sharing, you can set the maximum number of equal-cost routes to 1.
Networking requirements
As shown in the figure, there are four switches in the OSPF network, which belong to area 0. Configure load balancing so that SwitchA and SwitchC can be sent to SwitchD through SwitchB and SwitchC.
Description:
Ensure that the STP of the interconnected interface is not enabled in this scenario. Because a Layer 3 network is built on the VLANIF interface of the switch in the STP-enabled ring network, a port is blocked, causing Layer 3 services to fail.
Configure OSPF load balancing networking.
Configuration ideas
The configuration roadmap is as follows:
Configure basic OSPF functions on each switch to implement basic OSPF network interworking.
Configure load balancing on SwitchA to implement load balancing.
Steps
Configure the VLAN to which each interface belongs.
# Configure SwitchA. The configurations of SwitchB, SwitchC, and SwitchD are similar to those of SwitchA.
<HUAWEI> system-view
[HUAWEI] sysname SwitchA
[SwitchA] vlan batch 10 20 50
[SwitchA] interface gigabitethernet 1/0/1
[SwitchA-GigabitEthernet1/0/1] port link-type trunk
[SwitchA-GigabitEthernet1/0/1] port trunk allow-pass vlan 10
[SwitchA-GigabitEthernet1/0/1] quit
[SwitchA] interface gigabitethernet 1/0/2
[SwitchA-GigabitEthernet1/0/2] port link-type trunk
[SwitchA-GigabitEthernet1/0/2] port trunk allow-pass vlan 20
[SwitchA-GigabitEthernet1/0/2] quit
[SwitchA] interface gigabitethernet 1/0/3
[SwitchA-GigabitEthernet1/0/3] port link-type trunk
[SwitchA-GigabitEthernet1/0/3] port trunk allow-pass vlan 50
[SwitchA-GigabitEthernet1/0/3] quit
Configure the IP address of each VLANIF interface.
# Configure SwitchA. The configurations of SwitchB, SwitchC, and SwitchD are similar to those of SwitchA.
[SwitchA] interface vlanif 10
[SwitchA-Vlanif10] ip address 10.1.1.1 24
[SwitchA-Vlanif10] quit
[SwitchA] interface vlanif 20
[SwitchA-Vlanif20] ip address 10.1.2.1 24
[SwitchA-Vlanif20] quit
[SwitchA] interface vlanif 50
[SwitchA-Vlanif50] ip address 172.16.1.1 24
[SwitchA-Vlanif50] quit
Configure basic OSPF functions.
# Configure SwitchA.
[SwitchA] ospf 1 router-id 10.10.10.1
[SwitchA-ospf-1] area 0
[SwitchA-ospf-1-area-0.0.0.0] network 172.16.1.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] network 10.1.2.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] quit
[SwitchA-ospf-1] quit
# Configure SwitchB.
[SwitchB] ospf 1 router-id 10.10.10.2
[SwitchB-ospf-1] area 0
[SwitchB-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] quit
[SwitchB-ospf-1] quit
# Configure SwitchC.
[SwitchC] ospf 1 router-id 10.10.10.3
[SwitchC-ospf-1] area 0
[SwitchC-ospf-1-area-0.0.0.0] network 10.1.2.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.0] quit
[SwitchC-ospf-1] quit
# Configure SwitchD.
[SwitchD] ospf 1 router-id 10.10.10.4
[SwitchD-ospf-1] area 0
[SwitchD-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255
[SwitchD-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
[SwitchD-ospf-1-area-0.0.0.0] network 172.17.1.0 0.0.0.255
[SwitchD-ospf-1-area-0.0.0.0] quit
[SwitchD-ospf-1] quit
# Check the routing table of SwitchA.
[SwitchA] display ip routing-table
Route Flags: R - relay, D - download to fib
As shown in the routing table, the maximum number of equal-cost routes of the switch is 16 and the maximum number of equal-cost routes of the switch is 8. Therefore, the two next hops of SwitchA are 10.1.1.2 (SwitchB) and 10.1.2.2 (SwitchC). ) are all effective routes.
Configure equal-cost route priority on SwitchA.
If you do not want to implement load balancing on SwitchB and SwitchC, you can configure the equal-cost route priority and specify the next hop.
[SwitchA] ospf 1
[SwitchA-ospf-1] nexthop 10.1.2.2 weight 1 //Use the weight parameter to set the priority of the equal-cost route. By default, the weight is 255. The smaller the value, the higher the priority.
[SwitchA-ospf-1] quit
# View the routing table of SwitchA.
[SwitchA] display ip routing-table
Route Flags: R - relay, D - download to fib
As shown in the routing table, the priority of the next hop is 10.1.2.2 (SwitchC) (the weight is 1) and the next hop is 10.1.1.2 (SwitchB). Priority, so OSPF prefers the next hop to 10.1.2.2 as the only optimal route.
Configuration file
SwitchA configuration file
#
Sysname SwitchA
#
Vlan batch 10 20 50
#
Interface Vlanif10
Ip address 10.1.1.1 255.255.255.0
#
Interface Vlanif20
Ip address 10.1.2.1 255.255.255.0
#
Interface Vlanif50
Ip address 172.16.1.1 255.255.255.0
#
Interface GigabitEthernet1/0/1
Port link-type trunk
Port trunk allow-pass vlan 10
#
Interface GigabitEthernet1/0/2
Port link-type trunk
Port trunk allow-pass vlan 20
#
Interface GigabitEthernet1/0/3
Port link-type trunk
Port trunk allow-pass vlan 50
#
Ospf 1 router-id 10.10.10.1
Nexthop 10.1.2.2 weight 1
Area 0.0.0.0
Network 10.1.1.0 0.0.0.255
Network 10.1.2.0 0.0.0.255
Network 172.16.1.0 0.0.0.255
#
returnSwitchB configuration file
#
Sysname SwitchB
#
Vlan batch 10 30
#
Interface Vlanif10
Ip address 10.1.1.2 255.255.255.0
#
Interface Vlanif30
Ip address 192.168.0.1 255.255.255.0
#
Interface GigabitEthernet1/0/1
Port link-type trunk
Port trunk allow-pass vlan 10
#
Interface GigabitEthernet1/0/2
Port link-type trunk
Port trunk allow-pass vlan 30
#
Ospf 1 router-id 10.10.10.2
Area 0.0.0.0
Network 10.1.1.0 0.0.0.255
Network 192.168.0.0 0.0.0.255
#
returnSwitchC configuration file
#
Sysname SwitchC
#
Vlan batch 20 40
#
Interface Vlanif20
Ip address 10.1.2.2 255.255.255.0
#
Interface Vlanif40
Ip address 192.168.1.1 255.255.255.0
#
Interface GigabitEthernet1/0/1
Port link-type trunk
Port trunk allow-pass vlan 20
#
Interface GigabitEthernet1/0/2
Port link-type trunk
Port trunk allow-pass vlan 40
#
Ospf 1 router-id 10.10.10.3
Area 0.0.0.0
Network 10.1.2.0 0.0.0.255
Network 192.168.1.0 0.0.0.255
#
Return SwitchD configuration file
#
Sysname SwitchD
#
Vlan batch 30 40 60
#
Interface Vlanif30
Ip address 192.168.0.2 255.255.255.0
#
Interface Vlanif40
Ip address 192.168.1.2 255.255.255.0
#
Interface Vlanif60
Ip address 172.17.1.1 255.255.255.0
#
Interface GigabitEthernet1/0/1
Port link-type trunk
Port trunk allow-pass vlan 30
#
Interface GigabitEthernet1/0/2
Port link-type trunk
Port trunk allow-pass vlan 40
#
Interface GigabitEthernet1/0/3
Port link-type trunk
Port trunk allow-pass vlan 60
#
Ospf 1 router-id 10.10.10.4
Area 0.0.0.0
Network 172.17.1.0 0.0.0.255
Network 192.168.0.0 0.0.0.255
Network 192.168.1.0 0.0.0.255
#
Return
More you may be interested:
CCIE Security 400 251 Lab Exam Guide
What’s the CCIE Routing and Switching Topics(part two)