I have a router with a single physical interface connecting to the outside world and talking BGP to two ISPs.
Here's the BGP config:
router bgp 65100
network NETWORK mask 255.255.255.128
neighbor x.x.x.x remote-as 11830 (link to secondary connection)
neighbor x.x.x.x route-map METRIC in
neighbor y.y.y.y remote-as 11830 (link to primary connection)
neighbor y.y.y.y route-map METRIC in
According to the IP routing table, the router has two default gateways (one for each BGP), doing load balancing:
B* 0.0.0.0/0 [20/0] via y.y.y.29, 1w1d
[20/0] via x.x.x.5, 14:03:48
According to the BGP table, the preferred path should be y.y.y.129
Network Next Hop Metric LocPrf Weight Path
* 0.0.0.0 x.x.x.5 0 0 11830 i
*> y.y.y.29 0 0 11830 i
The problem that I'm having is that if we disconnect the second link (connection to x.x.x.5), everything stops working.
If I do a traceroute from the local network, we get out to the Internet using x.x.x.5, but according to the BGP table
the preferred path should be through y.y.y.29 (which is supposed to be the primary link).
My goal is to have all traffic going out via y.y.y.29 and if it fails to go over x.x.x.5 (and then come back to the primary
connnection when the primary link comes back).
How can I check what's going on?
Along with Timers you can use weight on the primary link so that your internal traffic will prefer this primary link.
If the primary link goes down traffic will automatically be diverted through the second link.
If the Primary link comes back up again traffic will automatically choose the preimary link with the secondary as back-up
We had a problem with a fiber and we physically disconnect the link to one BGP peer.
When we did this, all Internet traffic stopped working.
As soon as we connected the link back again (both BGP links up), then everything went back to normal.
We were surprised since, when disconnecting one BGP connection, the other one should assume the traffic.
I am going to do the test again as soon as possible to check the traceroute (when the link is down) and let you know.
The BGP configuration seems fine.
It might also be worth checking with the ISP to see what they see when you disconnect one of the links. I'm assuming that they dynamically receive your networks via EBGP advertisements because you do have a network statement in your BGP config but if they were using statics at their end for some of your networks then their routers might not realise your end has gone down so outbound traffic from you goes the right way but return traffic does not.
Also how long are you waiting after disconnection. Bear in mind BGP is not the quickest to failover and you have not modified your BGP timers so you could be looking at minutes before the ISP end updated and removed the route to your networks back via the disconnected link.
It seems that the router first try to reach the x.x.x.5, then y.y.y.29, but then again x.x.x.5
Is this a problem with the BGP peer y.y.y.29?
What does the maximum-paths 2 under BGP accomplishes? Load balancing?
Shouldn't it prefer the route mark as ''best'' under BGP?
By default even if there are multiple equal cost paths to the same destination BGP will only use one of them. By adding the maximum-paths 2 command you have told BGP it can use 2 equal cost paths. Hence the reason it tries x.x.x.5 then y.y.y.29 then x.x.x.5 etc..
If you want it to always use just one of the default-routes then you should look to remove the maximum-paths command but only if you are sure it is not being used for some other destinations other than the default-route.
It will then only use one of the paths. As they are both equal cost though it could choose either so you will need to make sure it picks the y.y.y.29. You can modify the weight for this if you want.