I took a look at the most relevant question, and am a step further but am not sure where to go from here.
I am currently trying to connect two ethernet interfaces but am having trouble establishing a connection to both interfaces at the same time. When I connect the second interface
enx000acd2f045e my connection through
enp0s31f6 to the Internet is disconnected. And unlike the cited answer, neither of my networks are disabled when I run
sudo lshw -c network.
$ sudo lshw -c network [sudo] password for maxgitt: *-network description: Ethernet interface product: Ethernet Connection (5) I219-LM vendor: Intel Corporation physical id: 1f.6 bus info: pci@0000:00:1f.6 logical name: enp0s31f6 version: 00 serial: 50:9a:4c:18:ad:9f size: 1Gbit/s capacity: 1Gbit/s width: 32 bits clock: 33MHz capabilities: pm msi bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=3.2.6-k duplex=full firmware=0.1-4 ip=220.127.116.11 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s resources: irq:138 memory:f7100000-f711ffff *-network description: Ethernet interface physical id: 1 bus info: usb@2:3.1 logical name: enx000acd2f045e serial: 00:0a:cd:2f:04:5e size: 1Gbit/s capacity: 1Gbit/s capabilities: ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation configuration: autonegotiation=on broadcast=yes driver=ax88179_178a duplex=full ip=192.168.3.4 link=yes multicast=yes port=MII speed=1Gbit/s
The answer did mention checking my routing table, stating that I can't have more than one gateway. So I ran the following:
Before connecting to
$ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 18.104.22.168 0.0.0.0 UG 100 0 0 enp0s31f6 22.214.171.124 0.0.0.0 255.255.255.0 U 100 0 0 enp0s31f6 126.96.36.199 188.8.131.52 255.255.255.255 UGH 100 0 0 enp0s31f6 169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 enp0s31f6
After connecting to
$ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.3.3 0.0.0.0 UG 0 0 0 enx000acd2f045e 0.0.0.0 184.108.40.206 0.0.0.0 UG 100 0 0 enp0s31f6 220.127.116.11 0.0.0.0 255.255.255.0 U 100 0 0 enp0s31f6 18.104.22.168 22.214.171.124 255.255.255.255 UGH 100 0 0 enp0s31f6 169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 enp0s31f6 192.168.3.0 0.0.0.0 255.255.255.0 U 0 0 0 enx000acd2f045e
Finally, he states "If you have two gateways, your routing table would have a double entry for dest 0.0.0.0 and the system can't handle this." I'm relatively new to networks and am not sure what I can do to fix this. It appears I may have a conflict on the first two rows of my routing table.
/etc/network/interfaces, this doesn't seem to be used for much in recent versions of Ubuntu let alone 16.04
The answer you cite has pointed you to the issue - it lies in the routing table. What's happening is you're having two "default routes" created (the 0.0.0.0 route). This is the route that matches if no other is found hence the default name.
In your case once the second interface is up you can see two default routes and the system uses the first one that matches, hence the enxXXX adaptor.
It's simplistic to say you can't have two default routes because everything is possible and you can have traffic balanced between the two but for your purposes it seems that you actually only want to use the original enpXXX interface for your Internet traffic? And have only LAN traffic through the other interface?
This is simple to accomplish - you need to disable the enxXXX adaptor being a default route (this will add a route to the LAN but not to the world 0.0.0.0) or set the routing order so the enpXXX interface comes first in the routing table.
There is a good description of how to use multiple NICs with Ubuntu here: https://askubuntu.com/questions/310355/networking-with-multiple-nics