postheadericon BGP Load Sharing with 2 ISP’s


Problem:

Two or more separate connections to the internet from different providers
provides network redundancy. Adding BGP routing with an AS (Autonomous System)
number will provide network failover without IP migration. The default BGP
configuration provides a single path selection. This tutorial will provide you
the information to load balance or share your outbound network connections
evenly.

Tools:

Monitoring tool of bandwidth (I like MRTG)

AS number from Arin.net

Class C network address or /24 Most ISP’s will not announce routes less than a
/24

Default routing from your providers at a minimum. This will work with partial
routes and default routes.

Network Diagram:

BGP ins – outs:

BGP will only select one path (the best) to install in the routing table. BGP
has a command maximum-paths. The maximum-paths command will load share between
equal costs routes. The problem is the AS paths are different because you have
internet connections to separate providers.

Solution:

The solution is very simple we will add our AS path to the incoming routes from
each ISP. The router will think the routes are from the SAME AS and will install
both into routing table. We will need to install the maximum-paths 2 in the bgp
configuration because bgp does not load share by default.

I am using fast Ethernet connection because I do not have enough serial
connections

ISP A Router Configuration:

Ethernet Interface

interface FastEthernet0/0

ip address 10.1.1.1 255.255.255.252

no ip directed-broadcast

duplex auto

speed auto

BGP Configuration to send default routing

router bgp 65535

neighbor 10.1.1.2 remote-as 27006

neighbor 10.1.1.2 default-originate

neighbor 10.1.1.2 soft-reconfiguration inbound

ISP B Router Configuration

Ethernet Interface

interface FastEthernet0/0

ip address 10.0.0.1 255.255.255.252

no ip directed-broadcast

duplex auto

speed auto

BGP Configuration to send default routing to the customer

router bgp 6500

neighbor 10.0.0.2 remote-as 27006

neighbor 10.0.0.2 default-originate

neighbor 10.0.0.2 soft-reconfiguration inbound

CPE Router Configuration

Fast Ethernet Interfaces

interface FastEthernet0/0

description to_ISP_A

ip address 10.1.1.2 255.255.255.252

duplex auto

speed auto

interface FastEthernet0/1

description to_ISP_B

ip address 10.0.0.2 255.255.255.252

duplex auto

speed auto

BGP Configuration

router bgp 27006

bgp log-neighbor-changes

neighbor 10.0.0.1 remote-as 6500

neighbor 10.0.0.1 route-map prepend-as in

neighbor 10.1.1.1 remote-as 65535

neighbor 10.1.1.1 soft-reconfiguration inbound

neighbor 10.1.1.1 route-map prepend-as in

maximum-paths 2

Route Map for Prepending AS

route-map prepend-as permit 10

set as-path prepend 27006

Check you work with show commands from the CPE

Make sure you both bgp peers are connected and sharing information

Show ip bgp summary

BGP router identifier 10.1.1.2, local AS number 27006

BGP table version is 2, main routing table version 2

1 network entries using 97 bytes of memory

3 path entries using 108 bytes of memory

1 multipath network entries and 2 multipath paths

4 BGP path attribute entries using 240 bytes of memory

4 BGP AS-PATH entries using 96 bytes of memory

0 BGP route-map cache entries using 0 bytes of memory

0 BGP filter-list cache entries using 0 bytes of memory

BGP using 541 total bytes of memory

1 received paths for inbound soft reconfiguration

BGP activity 2/1 prefixes, 5/2 paths, scan interval 60 secs

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd

10.0.0.1 4 6500 21 23 2 0 0 00:03:30 1

10.1.1.1 4 65535 22 23 2 0 0 00:03:29 1

Check to see if each peer is sending you a default route

Check the bgp table to see the routes Notice you will see you AS number
prepeneded to your ISP’s AS number. This is normal and needed for the
configuration to work.

cpe#show ip bgp

BGP table version is 2, local router ID is 10.1.1.2

Status codes: s suppressed, d damped, h history, * valid, > best, i – internal

Origin codes: i – IGP, e – EGP, ? – incomplete

Network Next Hop Metric LocPrf Weight Path

*> 0.0.0.0 10.1.1.1 0 27006 65535 i

* 10.0.0.1 0 27006 6500 i
cpe#show ip bgp neighbors 10.0.0.1 received-routes

BGP table version is 4, local router ID is 10.1.1.2

Status codes: s suppressed, d damped, h history, * valid, > best, i – internal

Origin codes: i – IGP, e – EGP, ? – incomplete

Network Next Hop Metric LocPrf Weight Path

* 0.0.0.0 10.0.0.1 0 6500 i

cpe#show ip bgp neighbors 10.1.1.1 received-routes

BGP table version is 2, local router ID is 10.1.1.2

Status codes: s suppressed, d damped, h history, * valid, > best, i – internal

Origin codes: i – IGP, e – EGP, ? – incomplete

Network Next Hop Metric LocPrf Weight Path

* 0.0.0.0 10.1.1.1 0 65535 i

Check to see if both routes have been installed in the routing table.

Show ip route

cpe#show ip route

Codes: C – connected, S – static, I – IGRP, R – RIP, M – mobile, B – BGP

D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area

N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2

E1 – OSPF external type 1, E2 – OSPF external type 2, E – EGP

i – IS-IS, su – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2

ia – IS-IS inter area, * – candidate default, U – per-user static route

o – ODR, P – periodic downloaded static route

Gateway of last resort is 10.1.1.1 to network 0.0.0.0

10.0.0.0/30 is subnetted, 2 subnets

C 10.0.0.0 is directly connected, FastEthernet0/1

C 10.1.1.0 is directly connected, FastEthernet0/0

B* 0.0.0.0/0 [20/0] via 10.1.1.1, 00:06:18

[20/0] via 10.0.0.1, 00:06:18

Everything looks great.  Now configure your monitoring tools to monitor
your outbound traffic, you should experience almost evenly distributed traffic.

If you have any comments or requests send to
my email
address admin@ccnalab.net

Next: Influencing Inbound Traffic

Cheers

Jim G

IBS Network Team

Thanks to Impact Business Solutions for use of the routers and bandwidth to set
up this scenario

4 Responses to “BGP Load Sharing with 2 ISP’s”

  • hariharank:

    Jim,

    this load sharing will be per packet or per destination…

    which is the best way to control the inbound traffic between two different service provider…

  • The Load sharing discussed in this document is for outbound traffic only and it is based on a per packet basis. 2 connections will divide your outbound traffic by 50% on each circuit.

    You can control inbound traffic by
    1. Prepending your AS number to make the link less attractive
    2. Some ISP will allow community strings to raise or lower your local preference within the ISP.
    I can assist you in determining the best solution if you send me some details about your network to admin@ccnalab.net
    Thanks for your Post
    Jim G

  • jamedina73:

    Hi, as you recommend I added my AS path to the incoming routes from
    each ISP but it didnot work, always prefer only one ISP do you have any idea why?

    Regards

  • Hello, A couple of suggestions you should try
    1. Make sure the ISP is sending the route to your router: show ip bgp
    2. In your BGP configuration you need to set the maximum-paths: maximum-paths 2
    3. Sometimes you have filters on your as-path or route-maps.

    Post your config minus passwords, ips, as numbers or send me an email with the config attached and the show ip route command admin@ccnalab.net

    Thanks
    Jim Gonzalez

Leave a Reply

You must be logged in to post a comment.