Suppose I have a machine on a network with two different valid, working gateways. Let's call 10.0.0.1
the "normal" gateway to the internet as supplied by an ISP and 10.0.0.2
a standalone VPN appliance that routes everything to a company's network before the big wider internet world. A side-effect of this is that they appear online from a different geographical location.
On this network, users (or their administrators) could choose which gateway to use on the basis of essentially what their DHCP server tells them, or they decide to set. This is a convenience for many -- you can have slightly faster, lower-latency access to the native country's internet via gateway A
and access to internal resources (and the US internet) via gateway B
.
For a machine running linux on this network, is it possible to change routes on a per application basis? I know that we could set a specific route on a per host basis with ip route
if we knew in advance where we'd like to send off the packets to, but what if we want to open one application (e.g. firefox) sending all of its packets to gateway A
and another (e.g. Chromium) to gateway B
?
This is obviously possible with vlans, VMs (or containers) and virtual network adapters, but I'm interested to know if there's a "bare metal" answer.