I have a Linux router multihomed:
- eth0: "Normal" unicast IP address, global reachable, a single default route
- eth1: Connected to an Internet Exchange, not global reachable, plenty of routes
The server runs frr and receives plenty of routes from the IX peers. By default, when connecting to some IP address where a route was received from the IX, the route's next hop is via eth1 and hence Linux uses the eth1 IP address as src-IP. Which of course will not work as the IX IP adresses are not global reachable.
So I need to tell Linux, for outgoing connections, to always use the IP address of eth0, regardless which route is used.
I found https://blog.sdn.clinic/2022/10/influencing-linux-source-address-selection-on-routes-installed-by-bird-and-frr/ and tried the "set src " approach in a frr route map, but for whatever reason that did not work for me:
route-map from-peer-v4 permit 11
description Mark prefixes from peers or transit to filter them outgoing
set community 1921:0
set src 185.222.xx.xx
exit
Are there other methods available in Linux to specify the src IP globally for all outgoing connections?