cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
873
Views
8
Helpful
9
Replies

BGP routing policy

I have two sites, connected to client- A with 1G cable using ebgp. I am advertising 1.1.1.0/24 from both site to client-A. Site-1 has 1.1.1.1 and site-2 has 1.1.1.2 server. How can I choose shortest path to reach 1.1.1.1 or 1.1.1.2 ? (10.1.2.0/24 natted to 1.1.1.1 ,10.1.1.0/24 natted to 1.1.1.2 )

(this is not real scenario but would like to know how can i do policy based routing for particular addresses?) 

1 Accepted Solution

Accepted Solutions

- For below configuration to work you must have /32 routes installed in the RIB for both 1.1.1.1/32 and 1.1.1.2/32

ip prefix-list net1 permit 1.1.1.1/32
ip prefix-list net1 permit 1.1.1.2/32
!
route-map net1-aspath permit 10
match ip address prefix-list net1
set as-path prepend 10 10 10

route-map net1-aspath permit 20


!
router bgp 10
neighbor 192.168.1.1 route-map net1-aspath out
net 1.1.1.1 mask 255.255.255.255
net 1.1.1.2 mask 255.255.255.255

View solution in original post

9 Replies 9

cofee
Level 5
Level 5

First you have to determine preferred path and then you can use local preference or weight to influence outbound traffic and as path for the inbound traffic, so you don't run into asymmetric routing issue.


Shorter path may not always be the best, you may have less hops/as path on 1 side, but the other side may provide better bandwidth/ faster link with more hops. 

this is inbound traffic (lets say telnet from client-A to server inside, sorry i dint provide this info before). 

local-pref and wight will work for outbound traffic. also, I am advertising 1.1.1.0/24, how can i set  as path (prepend) for specific 1.1.1.1/32 and 1.1.1.2/32 ? (natting with internal server ips) 

- For below configuration to work you must have /32 routes installed in the RIB for both 1.1.1.1/32 and 1.1.1.2/32

ip prefix-list net1 permit 1.1.1.1/32
ip prefix-list net1 permit 1.1.1.2/32
!
route-map net1-aspath permit 10
match ip address prefix-list net1
set as-path prepend 10 10 10

route-map net1-aspath permit 20


!
router bgp 10
neighbor 192.168.1.1 route-map net1-aspath out
net 1.1.1.1 mask 255.255.255.255
net 1.1.1.2 mask 255.255.255.255

 I am advertising 1.1.1.0/24. Cant advertise any other route. Otherwise this would work.

This is exactly my question is...if I am advertising /24, is there any way to do policy routing for specific routes?

Tnetwork design: 

           client-A

             /      \

           /          \

     Site-A ---Site-B

That's fine, you can advertise /32 routes with a longer as path without affecting /24 in your scenario. You just need to make sure that your router has /32 routes in the RIB. If you are using static routing then you just need to create 2 static routes for the /32 addresses. 

And yes policy routing can also be used but that would be independent of BGP. You will either have to use policy routing at the remote site as well so it takes the same path unless you are using as prepending for inbound traffic.

Hi

In order to advertise a prefix through BGP you have to advertise that with the same subnet mask like it is included into the RIB or routing table. Otherwise you need to include it manually like Cofee@0400 mentioned, using static routes so it will match with the entry into the routing table. 

:-)




>> Marcar como útil o contestado, si la respuesta resolvió la duda, esto ayuda a futuras consultas de otros miembros de la comunidad. <<

That's the thing, I cant advertise any other route then /24. I don't think so it is possible without advertising /32. Thank you.

Hello

With multiple ebgp peering from one rtr then utilizing weight path attribute would b3 applicable.

example:

access-list 21 permit 1.1.1.1

route-map server1 permit 10
match ip address 21
set weight 50000<---------------------------server1
route-map server1 permit 99
set weight 30000<---------------------------all other traffic 


access-list 23 permit 1.1.1.2

route-map server2 permit 10
match ip address 23
set weight 50000<---------------------------server2
route-map server2 permit 99
set weight 30000 <---------------------------all other traffic

router bgp xx
neighbor x.x.x.1 remote-as 21
neighbor x.x.x.1 description site 1
neighbor x.x.x.1 route-map server1 in

neighbor x.x.x.2 remote-as 23
neighbor x.x.x.2 description site2
neighbor x.x.x..2 route-map server2 in


res
Paul


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the community’s global network.

Kind Regards
Paul
Review Cisco Networking for a $25 gift card