It's either I have a fundamental misunderstanding on how interfaces are suppose to work or I've done something oddly wrong.

I have two interfaces:

  • eno1: (gateway
  • eno2: (gateway

If I unplug one cable and reboot, regardless of cable, it will have internet.

However, if I have them both plugged in, only one interface works (defaults to eno2). For example:

ping google.com -I eno2   # works
ping google.com -I eno1   # hangs forever

How do I get both statements above to work?

my /etc/network/interface:

# The loopback network interface
auto lo
iface lo inet loopback

allow-hotplug eno2
iface eno2 inet dhcp

allow-hotplug eno1
iface eno1 inet dhcp

my route:

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         UG    0      0        0 eno2   U     0      0        0 eno1   U     0      0        0 eno2


I found the way to fix this is route add default gw eno1. However, how do I properly do this on start-up (possibly by just editing /etc/network/interfaces).

Furthermore, now that I have 2 default destinations, how does linux know which one to use by default?


You only have one default gateway, thus outgoing packets will only be sent through that one; if you want to be able to use both connections, you need to manually add another default gateway (i.e. a route to using the other interface's gateway.

But please note that this will not use both connections at the same time; this is just not possible out of the box. One of the connections will be always used, the other one will only be used if the primary one fails; the preferred route is defined by the "metric" parameter.

  • Thanks. This solved my problem. See my update, though – Sanchke Dellowar Aug 18 at 21:55
  • The preferred route is defined by the metric; the route with the lowest metric will be used, unless it's unavailable. – Massimo Aug 18 at 21:58

By default linux routes outgoing packets by destination address only.
You need routing based on destination and source addresses.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.