0

I have seen Set specific interface for internet access and How to set up dual wired and wireless connections?, which essentially ask the same as this, however the answers there doesn't work for me, so I'm daring to ask the question again.

On my laptop (Ubuntu 14.04.4 LTS), I am using a Nexus 7 device to provide internet: Nexus goes on the internet wirelessly, and then shares this connection via USB tether, so the PC/laptop sees it as a wired connection.

In addition, I have a wired Ethernet connection to a router which is not connected to the internet, but instead forms a separate local network.

I would like to have access to both of these networks simultaneously. As per the posting above, I have set up the wired, local-only, Ethernet connection ("Auto Ethernet") thusly:

autoeth_setup.png

... so this connection should not try to go on the internet. However, it doesn't work.

When the wired, local-only, Ethernet connection ("Auto Ethernet") is disconnected from Network Manager:

autoeth_off.png

So I have this:

$ ip route
default via 192.168.42.129 dev usb0  proto static
192.168.42.0/24 dev usb0  proto kernel  scope link  src 192.168.42.214  metric 1

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.42.129  0.0.0.0         UG    0      0        0 usb0
192.168.42.0    0.0.0.0         255.255.255.0   U     1      0        0 usb0

$ ifconfig
eth0      Link encap:Ethernet  HWaddr ZZ:ZZ:ZZ:ZZ:ZZ:ZZ
          inet6 addr: XXXX::XXX:XXXX:XXXX:XXXX/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:372 errors:0 dropped:0 overruns:0 frame:0
          TX packets:780 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:37566 (37.5 KB)  TX bytes:93289 (93.2 KB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:4127 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4127 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:521681 (521.6 KB)  TX bytes:521681 (521.6 KB)

usb0      Link encap:Ethernet  HWaddr YY:YY:YY:YY:YY:YY
          inet addr:192.168.42.214  Bcast:192.168.42.255  Mask:255.255.255.0
          inet6 addr: XXXX::XXXX:XXXX:XXXX:XXXX/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7622 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7581 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:6076624 (6.0 MB)  TX bytes:1012195 (1.0 MB)

... and then the Internet works, i.e. I test with:

$ wget yahoo.com -O - 2>&1 | head -n 12
--2016-03-10 11:05:07--  http://yahoo.com/
Resolving yahoo.com (yahoo.com)... 206.190.36.45, 98.138.253.109, 98.139.183.24, ...
Connecting to yahoo.com (yahoo.com)|206.190.36.45|:80... connected.
HTTP request sent, awaiting response... 301 Redirect
Location: https://www.yahoo.com/ [following]
--2016-03-10 11:05:08--  https://www.yahoo.com/
Resolving www.yahoo.com (www.yahoo.com)... 46.228.47.114, 46.228.47.115, 2a00:1288:110:2::4001
Connecting to www.yahoo.com (www.yahoo.com)|46.228.47.114|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘STDOUT’
<!DOCTYPE html>

However, if I now turn on the wired, local-only, Ethernet connection ("Auto Ethernet"), so it is connected at the same time as the USB Internet connection:

autoeth_on.png

..., then I have this:

$ ip route
default via 192.168.42.129 dev usb0  proto static
192.168.0.0/24 dev eth0  proto kernel  scope link  src 192.168.0.100  metric 1
192.168.42.0/24 dev usb0  proto kernel  scope link  src 192.168.42.214  metric 1

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.42.129  0.0.0.0         UG    0      0        0 usb0
192.168.0.0     0.0.0.0         255.255.255.0   U     1      0        0 eth0
192.168.42.0    0.0.0.0         255.255.255.0   U     1      0        0 usb0

$ ifconfig
eth0      Link encap:Ethernet  HWaddr ZZ:ZZ:ZZ:ZZ:ZZ:ZZ
          inet addr:192.168.0.100  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: XXXX::XXX:XXXX:XXXX:XXXX/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:373 errors:0 dropped:0 overruns:0 frame:0
          TX packets:855 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:38156 (38.1 KB)  TX bytes:104645 (104.6 KB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:4195 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4195 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:530873 (530.8 KB)  TX bytes:530873 (530.8 KB)

usb0      Link encap:Ethernet  HWaddr YY:YY:YY:YY:YY:YY
          inet addr:192.168.42.214  Bcast:192.168.42.255  Mask:255.255.255.0
          inet6 addr: XXXX::XXXX:XXXX:XXXX:XXXX/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7746 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7706 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:6090188 (6.0 MB)  TX bytes:1028253 (1.0 MB)

At least ip route notes that the Internet traffic should be routed through the USB connection. However, if I try to work with the Internet now, for a few more calls it works, and then I get this:

$ wget yahoo.com -O - 2>&1 | head -n 12
--2016-03-10 11:10:58--  http://yahoo.com/
Resolving yahoo.com (yahoo.com)... 168.95.1.1, 2001:4998:c:a06::2:4008, 2001:4998:44:204::a7, ...

... and it locks there, waiting forever for a response that doesn't come in (and I cannot tell where did that resolution to 168.95.1.1 come from; it is apparently some DNS (dns.hinet.net as per http://mxtoolbox.com/SuperTool.aspx?action=ptr%3a168.95.1.1&run=toolpage - maybe something from the local router?!).

After that, if I disconnect the wired, local-only, Ethernet connection ("Auto Ethernet") from Network Manager, then Internet from the USB starts working again (although, if I've tried using Firefox in the previous state, then here I'd have to restart it).

As per my comment here: How to set up dual wired and wireless connections?, I had thought the reason for this is the "Require IPv4 addressing..." not being checked -- but it turns out, it simply prolongs the time while the thing is working a bit, but then again it reverts to non-working...

So, does anyone know how can I get both of these connections working simultaneously -- such that eth0 provides only traffic with 192.168.0.*; and traffic with all other addresses (public Internet) is handled through usb0?

0

A bit late for an answer, but nevertheless: your routing setup looks fine. As you point out, there is a problem with DNS resolution. There is something you can do to confirm that as the root issue:

ping 8.8.8.8 to see if routing works as intended. If you get a reply, it works.

In that case, you should make sure that the DNS setup is correctly handling both connections. In your case, it seems that the router's DHCP announces the router as DNS server, which then messes up your setup. Ways around that:

a) configure your router to not announce DNS via DHCP, or change the DNS server to 8.8.8.8 (Google DNS) b) Manually set a nameserver in \etc\resolv.conf. Potentially, you need to disable local DNS caching with dnsmasq in network-manager configuration file

Either solution should fix your problem.

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.