AR100-S, AR110-S, AR120-S, AR150-S, AR160-S, AR200-S, AR1200-S, AR2200-S, and AR3200-S CLI-based Typical Configuration Examples
Example for Configuring Dual-Uplink Internet Access Using Static IP Addresses for Load Balancing
Networking Requirements
In Figure 1, a small-sized enterprise deploys a router as an access gateway to provide Internet access for intranet users. To prevent network congestion when the network traffic is heavy, the enterprise deploys two uplinks on the router to connect to the Internet. Both links are connected to ISP networks through static IP addresses. To improve the network bandwidth, the enterprise requires that the Internet access traffic of intranet users be evenly forwarded on the two links. In addition, the enterprise requires that NAT be configured to enable intranet users to access the Internet.
Data Preparation
Item |
Data |
Description |
---|---|---|
Static IP address allocated by ISP 1 to the router's interface on link 1 |
Router's interface on link 1: GE0/0/1 IP address: 172.16.1.1/24 |
Router's Layer 3 interface for Internet access on link 1. This interface requires a manually configured static IP address. |
Static IP address allocated by ISP 2 to the router's interface on link 2 |
Router's interface on link 2: GE0/0/2 IP address: 10.1.1.1/24 |
Router's Layer 3 interface for Internet access on link 2. This interface requires a manually configured static IP address. |
IP address of ISP 1's gateway on link 1 |
172.16.1.2/24 |
ISP 1 gateway's IP address used to configure a route for instructing transmission of Internet access packets sent from intranet users. |
IP address of ISP 2's gateway on link 2 |
10.1.1.2/24 |
ISP 2 gateway's IP address used to configure a route for instructing transmission of Internet access packets sent from intranet users. |
IP address of the downlink interface on the router |
GE0/0/3: 192.168.1.1/24 |
Router's Layer 3 interface to which enterprise intranet users connect to. If many intranet users need to access the Internet, you can connect a Layer 2 switch to the router to support more access users. |
IP address of intranet user HostA |
192.168.1.2/24 |
Intranet IP address assigned to an intranet user for Internet access. |
Configuration Roadmap
- Configure a static IP address for GE0/0/1 on link 1 so that intranet users can access ISP 1 using this static IP address through link 1.
- Configure a static IP address for GE0/0/2 on link 2 so that intranet users can access ISP 2 using this static IP address through link 2.
- Configure outbound NAT in Easy IP mode on the two uplink interfaces on the router so that intranet users can access the Internet.
- Configure two equal-cost default routes to load balance traffic over the two links.
Procedure
- Configure a static IP address for GE0/0/1 on link 1 so that intranet users can access ISP 1 using this static IP address through link 1.
[Router] interface gigabitethernet 0/0/1 [Router-GigabitEthernet0/0/1] undo portswitch //Some Layer 2 interfaces can have static IP addresses configured only after their working mode is changed to Layer 3. [Router-GigabitEthernet0/0/1] ip address 172.16.1.1 24 //Configure the IP address assigned by ISP 1 for the interface on link 1. [Router-GigabitEthernet0/0/1] quit
- Configure a static IP address for GE0/0/2 on link 2 so that intranet users can access ISP 2 using this static IP address through link 2.
[Router] interface gigabitethernet 0/0/2 [Router-GigabitEthernet0/0/2] undo portswitch [Router-GigabitEthernet0/0/2] ip address 10.1.1.1 24 //Configure the IP address assigned by ISP 2 for the interface on link 2. [Router-GigabitEthernet0/0/2] quit [Router] interface gigabitethernet 0/0/3 [Router-GigabitEthernet0/0/3] undo portswitch [Router-GigabitEthernet0/0/3] ip address 192.168.1.1 24 //Configure an IP address for the router's downlink interface connected to the intranet. [Router-GigabitEthernet0/0/3] quit
- Configure outbound NAT in Easy IP mode on the two uplink interfaces on the router so that intranet users can access the Internet.
[Router] acl number 3002 [Router-acl-adv-3002] rule 5 permit ip source 192.168.1.0 0.0.0.255 //Allow only users on the 192.168.1.0 network segment to access the Internet. [Router-acl-adv-3002] quit [Router] interface gigabitethernet 0/0/1 [Router-GigabitEthernet0/0/1] nat outbound 3002 [Router-GigabitEthernet0/0/1] quit [Router] interface gigabitethernet 0/0/2 [Router-GigabitEthernet0/0/2] nat outbound 3002 [Router-GigabitEthernet0/0/2] quit
- Configure two equal-cost default routes to load balance traffic over the two links based on source IP addresses.
[Router] ip route-static 0.0.0.0 0 172.16.1.2 //Set the priority of the route over link 1 to the default value 60. [Router] ip route-static 0.0.0.0 0 10.1.1.2 //Set the priority of the route over link 2 to the default value 60. The two default routes have the same cost value. [Router] ip load-balance hash src-ip //Configure load balancing based on source IP addresses. [Router] quit
Verifying the Configuration
- Run the display ip routing-table protocol static command on the router to check static routes in its IP routing table. The routing table contains two equal-cost default routes destined to ISP 1 and ISP 2, respectively.
<Router> display ip routing-table protocol static Route Flags: R - relay, D - download to fib, T - to vpn-instance ------------------------------------------------------------------------------ Public routing table : Static Destinations : 1 Routes : 2 Configured Routes : 2 Static routing table status : <Active> Destinations : 0 Routes : 0 Static routing table status : <Inactive> Destinations : 1 Routes : 2 Destination/Mask Proto Pre Cost Flags NextHop Interface 0.0.0.0/0 Static 60 0 172.16.1.2 Unknown 0.0.0.0/0 Static 60 0 10.1.1.2 Unknown
- Run the ping command on HostA to ping the IP address of each ISP's gateway. This simulates the scenario where an intranet host accesses the Internet. HostA can ping the IP addresses of the gateways of ISP 1 and ISP 2 at the same time and the Internet access traffic can be load balanced over the two links.
Configuration File
# sysname Router # ip load-balance hash src-ip # acl number 3002 rule 5 permit ip source 192.168.1.0 0.0.0.255 # interface GigabitEthernet0/0/1 undo portswitch ip address 172.16.1.1 255.255.255.0 nat outbound 3002 # interface GigabitEthernet0/0/2 undo portswitch ip address 10.1.1.1 255.255.255.0 nat outbound 3002 # interface GigabitEthernet0/0/3 undo portswitch ip address 192.168.1.1 255.255.255.0 # ip route-static 0.0.0.0 0.0.0.0 172.16.1.2 ip route-static 0.0.0.0 0.0.0.0 10.1.1.2 # return