On my router I have two WANs (first is the default one, and the second will take over when first one is dead), and I need to do fetch of a given URL from the IP of second WAN port. The problem is, the IP of server I will fetch url from can change (CDN, actually) so I can’t just route/mangle traffic to it from second WAN statically.
At the same time I found no way to specify outgoing interface for
now i change old pfsense with GREAT Mikrotik
but how can i replicate that?
in fetch i can’t use --interface or similar
so i think to create an address list with domain www.ovh.com
and create a specific route to that address list (my opinion is not clear force a route with actual ip of www.ovh.com because ovh can change your ip)
An easy approach is to resolve the address each time it tries to update, add the address to an address list with a timeout and use a prefixed mangle and routing mark to route traffic via the proper interface.
If your eth2 gateway changes you need to put an on-lease script in the dhcp-client for eth2 to fix the gateway. Somthing like
script="/ip route set gateway=$gateway [find routing-mark=\"via_wan2\""
You better check if the default variable for the gateway is actually $gateway in the documentation.
edit:
BTW, ping, ssh, telnet (although its broken post 6.45.6 or so) support the routing-table parameter to route traffic.
I’ve already requested they add it to tool fetch without much success, maybe more people requesting would put it on the road map.