0

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=130.207.34.53 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 enx000

 $ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         130.207.34.1    0.0.0.0         UG    100    0        0 enp0s31f6
130.207.34.0    0.0.0.0         255.255.255.0   U     100    0        0 enp0s31f6
143.215.251.5   130.207.34.1    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 enx000

$ 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         130.207.34.1    0.0.0.0         UG    100    0        0 enp0s31f6
130.207.34.0    0.0.0.0         255.255.255.0   U     100    0        0 enp0s31f6
143.215.251.5   130.207.34.1    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.

  • Should I update:
    • the default gateway found in Ubuntu's Network menu OR
    • edit /etc/network/interfaces, this doesn't seem to be used for much in recent versions of Ubuntu let alone 16.04
Max
  • 227
  • 2
  • 4
  • 7

2 Answers2

1

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

Dave
  • 345
  • 1
  • 2
  • 12
  • Yes, your statement on using enpXXX for Internet traffic and enxXXX for LAN traffic is correct – Max Sep 15 '17 at 13:58
0

Thank you for your reference. It helped me solve the problem. I must've added in the default gateway to my routing table earlier. You can check and make sure that when you run ip route show that you only have 1 default gateway:

Before

$ ip route show
default via 192.168.3.3 dev enx000acd2f045e  proto static 
default via 130.207.34.1 dev enp0s31f6  proto static  metric 100

All I had to do was delete the second route via:

sudo route del default gw 192.168.3.3 enx000acd2f045e

After

$ ip route show
default via 130.207.34.1 dev enp0s31f6  proto static  metric 100
Max
  • 227
  • 2
  • 4
  • 7
  • Although this is indeed a "solution" it's not ideal as you need to run a command every time - you can add them into the networking scripts via the link in my answer to do that automatically after the interfaces come up. – Dave Sep 21 '17 at 17:15
  • You are correct. I went 1 step further and simply edited the Network Settings for IP addr 192.168.3.4 and deleted the Default Route that I had set to 192.168.3.3 – Max Sep 25 '17 at 16:44