I am using Ubuntu 14.04 with MATE, and my problem is that when I use a local Ethernet cable to access local network via a router (which is not connected to Internet), and at the same time Wireless (or Mobile Broadband) to access the internet - I cannot access the Internet, because apparently Ubuntu tries to first do Internet communication via the wired Ethernet cable, and it locks in there (as the wired Ethernet is, as I mentioned, not connected to Internet).
So, I've seen Set specific interface for internet access , where the answer is:
These routes are automatically created by NetworkManager. Try checking Edit ▸ IPv4 Settings ▸ Routes ▸ Use this connection only for resources on its network on the two LAN connections to prevent them from becoming the default gateway.
Ok, so I go to Network Connections / Edit, Edit the "Auto Ethernet connection", and enable "Use this connection only..." and Save. Then ifconfig
reports to me (say) 192.168.100.10 for eth0
, and so I test first pinging other local PCs:
$ ping 192.168.100.11
PING 192.168.100.11 (192.168.100.11) 56(84) bytes of data.
64 bytes from 192.168.100.11: icmp_seq=1 ttl=64 time=0.554 ms
64 bytes from 192.168.100.11: icmp_seq=2 ttl=64 time=0.638 ms
...
Well, so far so good; so I enable my Broadband - and at this point, I have this route:
$ ip route
default via 10.64.64.64 dev ppp0 proto static
10.64.64.64 dev ppp0 proto kernel scope link src 10.206.104.70
192.168.100.0/24 dev eth0 proto kernel scope link src 192.168.100.10 metric 1
... and let's see if pinging something online works:
$ ping google.com
PING google.com (168.95.1.1) 56(84) bytes of data.
64 bytes from 168.95.1.1: icmp_seq=1 ttl=224 time=1155 ms
64 bytes from 168.95.1.1: icmp_seq=2 ttl=224 time=436 ms
Oh nice, it works... or does it? Let's try retrieving something online:
$ wget http://google.com -O -
--2016-04-27 10:50:09-- http://google.com/
Resolving google.com (google.com)... 168.95.1.1
Connecting to google.com (google.com)|168.95.1.1|:80... ^C
Basically it hangs there for more than a minute, and I have to hit Ctrl-C to break/interrupt it.
And now, from Network Manager, I disconnect "Auto Ethernet", and when I try downloading the same resource again:
$ wget http://google.com -O -
--2016-04-27 10:51:12-- http://google.com/
Resolving google.com (google.com)... 95.209.200.29, 95.209.200.45, 95.209.200.38, ...
Connecting to google.com (google.com)|95.209.200.29|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://www.google.dk/?gws_rd=cr&ei=gX0gV4rVAYe6sQHrzbnICg [following]
--2016-04-27 10:51:13-- http://www.google.dk/?gws_rd=cr&ei=gX0gV4rVAYe6sQHrzbnICg
Resolving www.google.dk (www.google.dk)... 64.233.165.94, 2a00:1450:4010:c08::5e
Connecting to www.google.dk (www.google.dk)|64.233.165.94|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘STDOUT’
[<=> ] 0 --.-K/s <!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" ...
Well... now it works - but of course, NOT with the both connections active, but only with the Ethernet disconnected.
So let me repeat the question: how can I have two network connections active at the same time in Network Manager, such that the wired Ethernet connection is used to communicate only to the local network of the router it is connected to - and the wireless/broadband connection is used to access the Internet?
OK, I think I got it - my Auto Ethernet connection was set to Method "Automatic (DHCP)", and I noticed more-less by accident there is another option "Automatic (DHCP) addresses only", so I tried setting that:
... and finally, I can have both local Ethernet and broadband connections active - and I can access both local network addresses and Internet.
Hope that was it with this problem...
For any given interface, there would be a default route added if there is a gateway specified for it.
You could remove the default route using the following command to verify:
A better approach would be to only use gateway for the interface used to access internet.