Simple setup here. I have a machine with multiple network interfaces, two for example - eth0 and eth1.

eth0 has a static address and has a default gateway assigned. eth1 has a static address and will not have a gateway on that interface's network address range.

The Question

Do I need an entry in network configuration file (/etc/network/interfaces) for the gateway option on the interface that does not have a gateway on its network, eth1 in the above example?

Additional Questions

If I do something like:


Will this have adverse effects? Will this interface now have a way to reach a gateway or will using the loopback interface as a gateway have no effect (i.e. same as leaving the gateway option off entirely)?

Example config for discussion


# The loopback network interface
auto lo
iface lo inet loopback

# Interface 1
allow-hotplug eth0
iface eth0 inet static

# Interface 2
allow-hotplug eth1
iface eth1 inet static
gateway     # This is the line in question

1 Answer 1


You do not need a gateway entry for any NIC that you don't want to use to reach a network not in its collision domain (192.168/16 in this case). You can just omit that line if you don't want a gateway for that NIC.

I'm not sure what will happen if you try to use loopback as a gateway, but I wouldn't expect it to be happy times.

  • I haven't tested but I would guess that trying to set as a gateway for will not work because they are in disjoint networks: 127/8 vs 192.168/16.
    – zwets
    Aug 19, 2015 at 21:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .