Is there a way of dynamically load balancing two links using BGP such that if one link goes down traffic is automatically routed on the other link?
I am an administrator in an ISP. we have 2 links to two different internet bandwidth providers. One of the links has intermittent problems and we would like to load balance our clients on both links . How can this be achieved?
there is little BGP "knows" about underlying physical topology.
First scenario: redundancy
So in case the interface to an external neighbor goes down BGP should realize it at least because of the session timers (180 sec hold time per default). Timers can be adjusted even per neighbor. You could also use BFD (Bidirectional Forwarding Detection), if the neighboring provider would support such a setup.
Second scenario: load balancing
BGP is not really built for "perfect" load balancing- more for primary/backup scenarios. What you can do is to use local preference on the two peering routers to prefer one link for some networks and the other link for other networks in the internet. This might require some traffic analysis. As for the return traffic: it is not really possible, though AS path prepending for your networks might also allow you to get the return traffic for one of your networks through one link and for other networks through the other link. This will finally distribute the load to the two links.
In additional to Martin's post. If you consider the load-sharing solution, you also need to forecast the bandwidth utilization if one link down. i.e. Will the single link bandwidth able to support whole traffic requirement ?
If these are point-to-point connections, then you can also enjoy the in/out load-sharing. If it is pointing to two different locations or IX, etc. Then only outgoing traffic be load shared.
If it is service that you provide to the customer, you may able to provide in/out load-sharing, it depends on your config. and service.
Hope this helps.
In addition to this, you can consider using the "Optimized Edge Routing OER" feature for effective multihoming, which can also take the link load, latency etc into consideration before forwarding the packets....
Thank you all for the tips. I have done some research on all the options and now have a better understanding of BGP loadbalancing/sharing.