08-07-2023 03:52 PM
Hello Guys,
I hope you can help me with this issue, I have this topology with 4 routers running BGP which i want R1's Loopback 1 to have the R2 as an exit point and R1's Loopback 2 to have the R3 as an exit point. With which attribute can i achieve this ? and ping me if you want more details. Here is the LAB:
08-07-2023 03:56 PM
Hi @mHAJ
Would be nice if you could share the router´s config here. It would be easier to help you.
I believe must be more than one path here to fix it but it will depend on how did you setup it.
08-07-2023 04:02 PM - edited 08-07-2023 04:03 PM
Yeah sure, also need to confirm that communication is good i have load balancing in R1 but i just need this Manipulation to be done in R1 and im not sure if i should do it with weight or Local Preference
R1
interface Loopback1
ip address 1.0.0.1 255.255.255.0
!
interface Loopback2
ip address 2.0.0.2 255.255.255.0
!
interface FastEthernet0/0
ip address 12.0.0.1 255.255.255.0
duplex half
!
interface FastEthernet1/0
ip address 13.0.0.1 255.255.255.0
duplex half
router bgp 1
no synchronization
bgp log-neighbor-changes
network 1.0.0.0 mask 255.255.255.0
network 2.0.0.0 mask 255.255.255.0
network 12.0.0.0 mask 255.255.255.0
network 13.0.0.0 mask 255.255.255.0
neighbor 12.0.0.2 remote-as 1
neighbor 13.0.0.3 remote-as 1
maximum-paths ibgp 2
no auto-summary
B 4.4.4.0 [200/0] via 13.0.0.3, 00:22:15
[200/0] via 12.0.0.2, 00:22:15
08-07-2023 04:34 PM
There might be other solution but I would try this one
ip prefix-list R2_LINK permit 1.1.1.0/24
ip prefix-list R3_LINK permit 2.2.2.0/24
route-map to-R2 permit 10
match ip route-source prefix-list R2_LINK
set ip next-hop 12.0.0.2
route-map to-R3 permit 10
match ip route-source prefix-list R3_LINK
set ip next-hop 12.0.0.2
router bgp 1
no synchronization
bgp log-neighbor-changes
neighbor 12.0.0.2 route´-map to-R2 in
neighbor 13.0.0.2 route´-map to-R3 in
08-07-2023 05:14 PM
I tried this suggestion with a small change to the command: " neighbor 12.0.0.2 route-map R2 in "changing it from in to out because it showed me this:
R1(config-router)#neighbor 12.0.0.2 route-map R2 in
% "R2" used as BGP inbound route-map, route source match not supported
% not supported match will behave as route-map with no match
and it turned out that the R2 and R3 have removed R1's Loopback1 and Loopback2 in its BGP Table
08-08-2023 03:44 AM
Hello @mHAJ ,
>> which i want R1's Loopback 1 to have the R2 as an exit point and R1's Loopback 2 to have the R3 as an exit point.
BGP is a routing protocol and it works only on destination addresses.
You can use MED on R2, R3 to make R4 to choice R2 when sending traffic to subnet 1.0.0.0/24 and to make R4 to use R3 when sending packets to subnet 2.0.0./24
You need to use route-maps applied outbound to eBGP neighbor R4 where you set metric . Lower value is preferred and a missing value is considered like metric 0.
For the opposite direction , you have only a single destination prefix in AS 2, so you should think of using a form of PBR = Policy Based routing to achieve the desired results. Acting on source addresses is beyond what BGP can do.
Here, for the fact the test subnets are loopbacks you should use local PBR applied not at interface level but global level to achieve this.
Hope to help
Giuseppe
08-08-2023 04:27 AM
Yeah i just did that on R4 but not with MED but with Local Preference and it worked perfectly sending traffic for 1.0.0.0/24 through R2 and traffic for 2.0.0.0/24 through R3 :
Network Next Hop Metric LocPrf Weight Path
*> 1.0.0.0/24 24.0.0.2 2 222 0 1
*> 2.0.0.0/24 34.0.0.3 2 333 0 1
So that means my request is beyond BGP levels, i was wondering if it can be done with any of BGP Attributes but unfortunately it seems not.
08-08-2023 04:54 AM
Hello @mHAJ ,
>> i just did that on R4 but not with MED but with Local Preference and it worked perfectly sending traffic for 1.0.0.0/24 through R2 and traffic for 2.0.0.0/24 through R3
yes this an alternative solution for the direction AS2 --> AS1
As I have written before because AS 2 originated a single IP prefix in the direction AS1 -> AS2 there is little BGP can do as it is limited to act on destination addresses.
Acting on source IP addresses requires the use of PBR as explained before
Hope to help
Giuseppe
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide