Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
New Member

BGP preferred route

I have 2 routers setup for BGP and want .177 to be the preferred route. How can I accomplish this?

No matter what I tried .178 always wants to be the preferred route. I have tried changing the local-preference but that doesn't help.

Attached are the 2 snippets from the 2 routers.

1 ACCEPTED SOLUTION

Accepted Solutions
Hall of Fame Super Silver

Re: BGP preferred route

Hello Chen,

if you want to speed up convergence you can use

r.177:

# clear ip bgp *

but this is disruptive the sessions are restarted so depending on how many prefixes you are receving it can take a few minutes to recover.

Hope to help

Giuseppe

14 REPLIES
Hall of Fame Super Silver

Re: BGP preferred route

Hello Chen,

your two routers r177 and r178 are in two different AS numbers :

r177 uses AS 65401

r178 uses AS 65451

both of them are advertising the subnet

172.29.186.176 mask 255.255.255.240

that is the only prefix advertised and already has an origin IGP so the route-map applied to the third router is currently redundant (it has no effects)

the third router makes its choice based on the BGP selection path algorithm.

However, you have built a scenario that is not allowed in the real world.

Public IP address blocks are associated to one and only one AS number.

So in the real world two options:

a) r177 and r178 are in the same AS

b) r177 and r178 are in a different private AS but they are part of a BGP confederation and are seen as a single AS number in the outer world by the third router.

Going back to your scenario:

To influence the choice of the third router you can only change the MED = multi exit discriminator

so the route-map can be modified by adding set metric 100 on r177

and set metric 200 on r178

then on the third router, because r177 and r178 are in different ASes you need to enable comparison of MED in all cases

on third router:

router bgp XX

bgp always-compare-med

bgp deterministic-med

after this the best path should be the one with lower metric/MED.

if in a lab environment you can speed up convergence by resetting BGP sessions on third router with clear ip bgp *

Hope to help

Giuseppe

New Member

Re: BGP preferred route

Thank you for the response.

There is no third router. The 2 routers are configured for HSRP and I set the server's default gateway to the HSRP IP. The .177 is the HSRP router with the higher priority. However .177 always forwards packets to .178 before exiting the network. I want .177 to exit the network rather than .178.

Hall of Fame Super Silver

Re: BGP preferred route

Hello Chen,

with third router I mean the router with ip

172.29.184.93 remote-as 65400

neighbor 172.29.185.93 remote-as 65450

I see that you used a different AS on the two routers and this is difficult.

Who is the owner of ip 172.29.186.190 the next hop address of default route on both R177 and r178

on r177 and r178 do

sh ip route 172.29.186.190

trace 172.29.186.190

Note : here BGP plays no role at all : if there is no external BGP neighbor providing a default route or a full BGP table the exit path is chosen by the default static route

do a sh ip bgp to check it

Hope to help

Giuseppe

New Member

Re: BGP preferred route

172.29.184.93 remote-as 65400 and

172.29.185.93 remote-as 65450

Those are out of my control.

These are 2 paths to the outside world.

172.29.186.190 is the vlan interface for access into the internal network.

Note: This is a private network.

Hall of Fame Super Silver

Re: BGP preferred route

Hello Chen,

ok so the external routers are two on two different AS domain

Do you receive BGP routes from these two routers ?

or the default static route is used.

172.29.186.190 is the ip address of an internal router

Verify on r177 and r178 how they send packets to 172.29.186.190 : for the recursion principle all traffic that doesn't have an explicit route will use the default and will be forwarded as the default route ip next-hop.

You should find out why r177 sends traffic to r178.

Note: Sorry I made some confusions about ip addresses

Hope to help

Giuseppe

New Member

Re: BGP preferred route

I do receive routes from these 2 routers.

Default static route is not used.

172.29.186.190 is the ip address of an internal router.

Well, I am trying to reach 69.50.113.147 from 172.29.186.185 .

tracert 69.50.113.147

Tracing route to 69.50.113.147 over a maximum of 30 hops

1 <1 ms <1 ms <1 ms 172.29.186.177

2 1 ms <1 ms <1 ms 172.29.186.178

3 5 ms 3 ms 3 ms 172.29.185.93

4 4 ms 3 ms 3 ms 172.29.185.65

5 254 ms 253 ms 255 ms 172.21.211.49

6 255 ms 273 ms 253 ms 172.20.217.94

7 259 ms 255 ms 253 ms 10.81.0.106

8 255 ms 254 ms 253 ms 10.81.0.74

9 253 ms 253 ms 254 ms 69.50.113.147

See that packets gets forwarded from .177 to .178

If I shut the outside interface of .178, packets get forwarded to 172.29.184.93.

Hall of Fame Super Silver

Re: BGP preferred route

Hello Chen,

on r.177

do

sh ip bgp 69.50.113.147

do it also on r.178

the BGP path via r.178 is preferred for some reason and you need to discover why

May be router 172.29.185.93 is passing a more specific route to r.178 then the other external router is passing to r.177.

In this case what you see is normal and an iBGP path via r.178 is preferred over an eBGP path on r.177

Hope to help

Giuseppe

New Member

Re: BGP preferred route

Thank you for the kind help

.177

sh ip bgp 69.50.113.147

BGP routing table entry for 69.50.113.128/25, version 715

Paths: (2 available, best #1, table Default-IP-Routing-Table)

Not advertised to any peer

65451 65450

172.29.186.178 from 172.29.186.178 (172.29.186.178)

Origin IGP, localpref 100, valid, external, best

65400 65400 65400 65400

172.29.184.93 from 172.29.184.93 (172.31.9.112)

Origin IGP, metric 64512, localpref 100, valid, external

.178

sh ip bgp 69.50.113.147

BGP routing table entry for 69.50.113.128/25, version 311

Paths: (1 available, best #1, table Default-IP-Routing-Table)

Advertised to update-groups:

1

65450

172.29.185.93 from 172.29.185.93 (172.31.9.113)

Origin IGP, metric 20224, localpref 100, valid, external, best

How can I influence .177 to be the preferred route?

Hall of Fame Super Silver

Re: BGP preferred route

Hello Chen,

the eBGP neighbor of r.177 is doing AS path prepending:

65400 65400 65400 65400

for this reason the r.177 prefers the eBGP path that it learns via iBGP connection from r.178.

Now, the scenario is clear.

Be aware that who manages the routers on the other side is trying to influence you on using the eBGP neighbor of r.178 he/she has some reasons for doing this.

On your side you can make the eBGP neighbor of r.177 the preferred path by changing one of the parameters that are checked before looking at AS path length in BGP selection path.

a) to influence only r.177

use weight concept

r.177

router bgp xxx

neigh 172.29.184.93 weight 500

this is enough to make r.177 uses the eBGP path via 172.29.184.93 for all prefixes it learns from it.

If you want to make it more selective you can use a route-map

access-list 10 permit 69.50.113.0 0.0.0.127

route-map rise-weight permit 10

match ip address 10

set weight 500

route-map rise-weight permit 20

! empty block to accept other prefixes with no changes

router bgp xxxx

neigh 172.29.184.93 route-map rise-weigth in

b)

if you want to influence also r.178 to use r.177 for all or some prefixes r.177 learns from 172.29.184.93

you need to use local preference on r.177

access-list 11 permit any

route-map rise-locpref permit 10

match ip addr 11

set local-preference 200

router bgp xxxx

neigh 172.29.184.93 route-map rise-locpref in

Hope to help

Giuseppe

New Member

Re: BGP preferred route

I have put in neigh 172.29.184.93 weight 500.

Should I do anything else for the router to recalculate the routes?

Hall of Fame Super Silver

Re: BGP preferred route

Hello Chen,

if you want to speed up convergence you can use

r.177:

# clear ip bgp *

but this is disruptive the sessions are restarted so depending on how many prefixes you are receving it can take a few minutes to recover.

Hope to help

Giuseppe

New Member

Re: BGP preferred route

Thank you very much. This solved my problem.

Hall of Fame Super Silver

Re: BGP preferred route

Hello Chen,

nice to hear that your problem is solved.

Thanks for your kind remarks and the solved flag this tells this case has an happy end and can be useful to somebody else.

Best Regards

Giuseppe

New Member

Re: BGP preferred route

Hi Gius,

This information is extremely helpful. It helped me to resolve the similar issue. Appreciate your effort on this.

Taj

444
Views
0
Helpful
14
Replies
CreatePlease to create content