Debian – One Gateway 2 interfaces how to?

Ragnar asked:

I have this scenario.

4 VM Debian8 : 1 DHCP 1 DNS 1 GW 1 Client

I can ping from all my VM (except GW) each other (@ip or hostname).

My GW have 2 interfaces (eth0->LAN / eth1->WAN). From it I can ping but I cannot ping my LAN (except with @ip).

In the file /etc/resolv.conf I have the DNS form my box on the WAN. If I put the conf of my LAN it’s the reverse (of course). I can ping my LAN but not WAN.

I activated ip_forward and I know I have to do some work with route but I have to admit I don’t really understand the command for route.

Can you explain me the logic of this ?

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         UG    0      0        0 eth0         UG    0      0        0 eth1   U     0      0        0 eth1   U     0      0        0 eth0

My answer:

The LAN interface of your gateway VM should not have a gateway defined in /etc/network/interfaces. The gateway represents the default route to the Internet, and you have only one such route (via WAN, not LAN). Remove it, and then restart networking.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.