I have following scenario: My AS: 64501 has two routers R3 (Redundand) and R4 (Main).

ISP AS: 64500 has 3 routers R1, R2 and R5

I have eBGP peering with ISP, I have no access to ISP configuration, only to configuration on my net (R3, R4).

enter image description here

I need that incoming traffic from ISP always was sent to Main router (R4) and only if Main isn't accessible send traffic to Geo redundant (R3).

I can do it using AS-PATH Prepend sent from Geo-redundant router (R3) and it's working:

enter image description here

But in this case traffic in ISP from R5 is sent as showed on picture (via R1-R2-R4) - one more hop, not straight (R5-R2-R4). This happens because iBGP is not using AS-PATH prepend, so R1 is preferring route via R2, as route R1<->R3 is prepended. But R1 is sending iBGP route update to R5 without as-path prepend. So for R5 there are two equal routes to My network, and it's choosing route via R1, as R1 IP address is lower that R2 IP.

Question#1: Can I configure somehow devices only in My network, so traffic will pass like this, without MED or Communities?

Questions#2: Can I configure somehow devices in My and in ISP network, so traffic will pass like this, without MED or Communities?

enter image description here

Thank you.

4 Answers 4


I think you are confusing routers and ASes. To BGP, an AS is a hop, not a router. You can try to influence a neighbor AS for which peer it uses to send traffic to your AS, but the neighbor AS is free to ignore your suggestions.

It looks like your neighbor AS is following your suggestion for which of your routers it should use to get to your AS, and you could specify which of your routes could come in on which of your routers, but you cannot control routing inside the neighbor AS to the degree that you seem to want. In any case, MED wouldn't be any more effective than AS prepending. Both are pretty blunt, and neither will give you any degree of control inside the neighbor AS.

You would need to work with the neighbor AS administrators to see if you could come to some arrangement. That may be using communities, or it may be something the neighbor AS administrators want to do on their own. You simply have no direct control over what happens in a different AS. That is the Autonomous in Autonomous System.

Question#1: Can I configure somehow devices only in My network, so traffic will pass like this, without MED or Communities?

Nothing you do in your AS will change the internal routing of a neighbor AS.

Questions#2: Can I configure somehow devices in My and in ISP network, so traffic will pass like this, without MED or Communities?

You don't have the authority to configure devices in your neighbor's AS.

Your problem seems to be that your neighbor AS prefers to send R5 traffic to R1, and that is its right, and there really isn't anything you can do about that, except through business negotiation. What you could do is to make R3 your main router, and R4 your backup router. That would achieve your goal, at least until you are in a failover situation, at which point you will be in the same situation you are now.

  • Thank you for answer. In current example for R5 it doesn't mater if there are or not prepends from customers, the only device that is taking in consideration prepends are edge routers (R1 and R2). For R5 routes that came from R1 are equal to ones from R2. Let's say I am ISP administrator and I want that routes that came with prepends on R1 or R2 will be propageted inside iBGP (to R5) with lower value of Local Preference for instance. In that case if R1 has routes with prepends - it will send it to R5 with lower Local Pref. and hence R5 will prefer route via R2 . Is it possible? Dec 28, 2016 at 9:20
  • No, this is not true. If the AS-Path is not altered by the edge routers (strip private ASs, replace-as or stuff like this), the AS-Path in the updates on R5 still contain the prepended as. Have a look at the BGP decision process for more details - there are good examples out there. Refer to my answer below - setting localpref based on the as-path length is possible and possibly could solve your second question.
    – Daniel
    Dec 28, 2016 at 11:03
  • @DmitriiGangan, your neighbor AS administrators can do that, but your AS cannot do that in your neighbor's AS. That is why you would need to negotiate at a business level. You simply have no control what happens in your neighbors' ASes, just as you do not want your neighbors' AS administrators to have control of what happens in your AS. As Ron Trunk and I have pointed out, each AS is Autonomous. That means it has independent control of its own routing. You really can't even know if that is how your traffic is routed inside the neighbor AS unless the administrators told you.
    – Ron Maupin
    Dec 28, 2016 at 17:47

Just to expand on @RonMaupin 's answer --

The whole point of BGP is that the AS administrator is the one who gets to decide how the traffic flows in his or her network -- not you. You can signal your desires, but the AS admin can (and often does) ignore them.

Now since, in your example, you can see inside AS64500, you wonder why traffic flows the way it does. You have assumed that iBGP ignores prepends, but that is not the case.

R1 receives advertisements from both R3 and R2. R3 advertises the prefix with the prepends, but R2 does not. So R1 chooses the shorter path advertised by R2 and that is what it installs in its routing table.


To extend the other two answers: The issue here is IGP routing inside the AS64500. The actual question is, why does R5 send the traffic to R1 instead of R2?

R5 only has one BGP route, which is the one without prepending. This is because R1 learns both the eBGP routes including the prepending and the iBGP route from R2 and prefers the route from R2 due to the shorter AS-Path (assuming, no weight or local-pref is set). Hence R1 will only advertise its best path to its neighbours, R5 ends up with only knowing the path without advertising.

The actual paths depends on the IGP routing. The BGP routing update received by R5 contains the next-hop field, which is most likely either set to R4's address on the R2-R4 link or to one of R2's addresses (next-hop-self configured on R2). This next-hop is then resolved using the configured IGP, which dictates the actual routing of the packet.

To answer your second question (you hardly can influence IGP path decisions in another AS via your BGP configuration), have a look at R5, check which next-hop is advertised on the BGP routing update and have a look in the IGP-resolution of this next-hop. This should give you a fairly good idea why the traffic is routed the way it currently is. If you can modify the BGP config of the ISP, you could also use any other "BGPish" way to accomplish that. There are many ways, including local-preference.


Well, if R2 has the best route to the destination prefix from your AS 64501, R5 and R1 should also have that in their BGP tables (Rule: All EBGP and best IGBP routes). So if ISP is using only iBGP inside their AS, then traffic from R5 should normally follow the path you desire (R5-R2-R4). The only thing i believe (could be right) is ISP is using a lower AD protocol in R5 (for ex: static route) to steer traffic towards R1. Like other members commented, you cannot influence routing inside another AS which is not in your control. It's also a strange thing for me that how could you get figure out that the traffic is coming from R5-R1 ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.