Set source IP for traffic originating from the router

I have 3 tunnels connected via different internet uplinks and routed thru a VPS with OSPF. I announce a dummy interface IP to the other end as a consistent destination for traffic to route across one of the 3 active tunnels.

the issue I'm seeing is traffic that originates from the Openwrt router uses the interface IP of the link that is active, such as a DNS or NTP connection. This isn't preferred because I would like to not announce these /30 PTP links in my larger BGP network.
I want to make all traffic originating from the router to use the IP assigned to the dummy interface as the source address for all packets, is this possible in openwrt?

Can't you configure the preferred source addresses of the routes that are used?

BTW the source option of IPv4 routes in OpenWrt is the preferred source address.


If you use bird for the bgp you could use and set krt_prefsrc when exporting routes to the kernel table.

1 Like