I've got two WAN interfaces coming into a Debian 8 VM.
WAN 1 - All Internet and local traffic. (0.0.0.0/0) Has a a static IP, thus IP, netmask and gateway are fixed values.
WAN 2 - Specific private subnet traffic only (10.100.0.0/16). IP obtained via DHCP, can be anywhere in the 10.0.0.0/8 range.
I don't have control over WAN2 (The link is supplied by the ISP) so I am faced with a dual gateway situation.
Right now, here is how I have it set up.
iface eth0 inet static
address 172.16.100.100
netmask 255.255.255.0
gateway 172.16.100.1
iface eth1 inet dhcp
I then manually bring up eth1, obtain the DHCP gateway IP, then set a static route for 10.100.0.0/16 manually. This works fine, of course, until the DHCP lease renews, which is about every 4 days. At which point I have to bring down eth1, bring it back up, note the new gateway and set the new static route.
I've tried setting a static route to 10.100.0.0/16 via eth1, but without any knowledge of the next-hop gateway IP.. of course that doesn't work.
I've also tried several iproute2 setups but it still boils down to knowing the next-hop address it would seem.
What i'm trying to solve - How can I set a static route for eth1 given that I have no knowledge of the next-hop address as it constantly changes via DHCP?