Default route not on LAN
Posted
by
jarmund
on Server Fault
See other posts from Server Fault
or by jarmund
Published on 2012-10-07T22:48:00Z
Indexed on
2012/10/08
3:38 UTC
Read the original article
Hit count: 513
I have a network that in principle looks like this:
H1---\ /----Inet1
H2---->---GW1---<
H3---/ \----GW2-----Inet2
- H1 and H2 = Hosts that need access to internet with GW1
- Inet1 = Internet link over 3G connection
- Inet2 = 5GHz link to Internet (not always up)
- GW1 = Works as a router, automatically picking the "best" connection between Inet1 and Inet2 (the latter via GW2).
- GW2 = 5GHz wifi router
And here's the problem: H3 only needs internet access when Inet2 is up. What i was thinking of doing was a routing table that looks like this:
- route to GW2 via GW1
- default route is via GW2
I first set the route to GW2 via GW1 without a problem. But when i try
route add default gw 1.2.3.4
(1.2.3.4 being the IP of GW2), it complains "SIOCADDRT: No such device" Is the problem that the default gw i'm trying to set is not reachable directly? Is there a different approach that would allow me to achieve this?
An alternative (and hypothetical) approach: Since H3 will be using a static IP, is it possible to do some magic with iptables on GW1 to forward any packets from H3 to GW3, thereby "tricking" H3 into using GW2 as its default router?
© Server Fault or respective owner