When bgp is configured on a router with dual ISP connections, one of the requirements is to allow all upload traffics through one of the ISPs and load-balance the downloads traffics across both links. This setup can be achieved in two ways and in this demonstration, I will share on how to use the bgp default-originate command to force the router to prefer a particular ISP for upload traffics from the LAN.
For this LAB, we have connections from two upper providers. The task bothers on controlling upload traffics from the LAN while the download traffics will be load-balanced across both links based on bgp preferences. See topology below.
Network Topology
The core router will be configured to establish bgp peerings with both ISPs and advertise the two prefixes to them. Traffics destined to both prefixes from the internet will be routed through the best route to reach the networks. However, upload traffics will be controlled using default routes injected into the core router’s routing with the default-originate command from both ISPs . The advantage of using this method is that a default route will be removed once the ISP goes down, allowing upload traffics to go to the second ISP.
Implementation
On the core router, I will configure the two interfaces connected to both ISPs, configure two loopback interfaces with IP addresses from the two prefixes to be advertised in BGP, and establish ebgp peering with the two upper providers. See commands below:
Core(config)#interface Loopback1
Core(config-if)#ip address 180.20.1.1 255.255.255.0
Core(config-if)#interface Loopback2
Core(config-if)#ip address 189.20.1.1 255.255.255.0
Core(config-if)#interface FastEthernet0/0
Core(config-if)# ip address 1.1.1.2 255.255.255.252
Core(config-if)#desc connection to ISP1
Core(config-if)#no shut
Core(config-if)#interface FastEthernet0/1
Core(config-if)# (config-if)# ip address 2.2.2.2 255.255.255.252
Core(config-if)#desc connection to ISP2
Core(config-if)#no shut
Core(config-if)#exit
Core(config-router)# router bgp 300
Core(config-router)#neighbor 1.1.1.1 remote-as 100
Core(config-router)# neighbor 1.1.1.1 activate
Core(config-router)# neighbor 1.1.1.1 update-source FastEthernet0/0
Core(config-router)# neighbor 2.2.2.1 remote-as 200
Core(config-router)# neighbor 2.2.2.1 update-source FastEthernet0/1
Core(config-router)# neighbor 2.2.2.1 activate
Core(config-router)# network 180.20.1.0
Core(config-router)# network 189.20.1.0
You may also like: Configure Cisco dhcp relay agents using packet tracer in two minutes
ISP1 Router
On ISP1’s router, I will assign an IP address to the interface connecting to the core router, establish bgp peering and inject a default route into the routing table of the core router, using the default-originate command. See the commands below.
ISP1(config-if)#interface FastEthernet0/0
ISP1 (config-if)# ip address 1.1.1.1 255.255.255.252
ISP1 (config-if)#desc connection to Core
ISP1 (config-if)#no shut
ISP1 (config-if)#exit
ISP1 (config-router)# router bgp 100
ISP1 (config-router)#neighbor 1.1.1.2 remote-as 300
ISP1 (config-router)#neighbor 1.1.1.2 activate
ISP1 (config-router)#neighbor 1.1.1.2 update-source FastEthernet0/0
ISP1 (config-router)#neighbor 1.1.1.2 soft-reconfiguration inbound
ISP1 (config-router)#neighbor 1.1.1.2 default-originate
ISP2 Router
On ISP2’s router, I will enter configuration commands similar to the ones entered on ISP1. The difference will be the IP address and the AS number. See commands below.
You may also like: How to protect your router from being consumed by bgp route updates
ISP1(config-if)#interface FastEthernet0/0
ISP1 (config-if)# ip address 2.2.2.1 255.255.255.252
ISP1 (config-if)#desc connection to Core
ISP1 (config-if)#no shut
ISP1 (config-if)#exit
ISP1 (config-router)# router bgp 200
ISP1 (config-router)#neighbor 2.2.2.2 remote-as 300
ISP1 (config-router)#neighbor 2.2.2.2 activate
ISP1 (config-router)#neighbor 2.2.2.2 update-source FastEthernet0/0
ISP1 (config-router)#neighbor 2.2.2.2 soft-reconfiguration inbound
ISP1 (config-router)#neighbor 2.2.2.2 default-originate
At this point, a look a the Core’s routing table will display a default route from ISP1. This means that all upload traffics will be sent out ISP1. In the event that ISP1’s connection goes down, the default route from ISP2 will be displayed and will take up control. This method, unlike the conventional method of setting the default route on the core router itself, ensures that a default route entry from an ISP is removed once the link becomes unreachable. Note that this lab was done using GNS3 with the c3600 series router.
Verification
Use the show ip route command on the core router to view the routing table. See below
If I shut down the interface connecting to ISP1 and view the routing table again, I will see a default route pointing to ISP2. See below.
If you enjoyed this tutorial, please subscribe to this blog to receive my posts via email. Also subscibe to my YouTube channel, like my Facebook page and follow me on Twitter.