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: 10.6.59.203/24 (gateway 10.6.59.1)
eno2: 192.168.5.100/24 (gateway 192.168.5.1)
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?
# The loopback network interface auto lo iface lo inet loopback allow-hotplug eno2 iface eno2 inet dhcp allow-hotplug eno1 iface eno1 inet dhcp
Destination Gateway Genmask Flags Metric Ref Use Iface default 192.168.5.1 0.0.0.0 UG 0 0 0 eno2 10.6.59.0 0.0.0.0 255.255.255.0 U 0 0 0 eno1 192.168.5.0 0.0.0.0 255.255.255.0 U 0 0 0 eno2
I found the way to fix this is
route add default gw 10.6.59.1 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?