How to Configure Ubuntu to Access Internet only with Wifi Ignoring Wire Connection (Ethernet)

Context:

  • the Wifi connection works perfectly with the DHCP of the router. Only with this connection, I can navigate the web.
  • the wire connection is necessary for me to be connected directly with an embedded system. In the middle, there is a Switch and the only thing I do is to set up the address IP of both (laptop and embedded system). The systems speak perfectly using ssh etc. No problem here.
  • OS Xubuntu 16.04 on my laptop and a Linaro on the embedded (please note: the problem is the same for 18.04 and the solution proposed in the answer works properly).

Problem: When I am connected to the system with the ethernet connection, it is impossible for me to navigate on the web. I guess it is because the laptop tries to access using the ethernet connection. Of course, the ethernet connection goes only to the embedded system (no web from this side).

Question: Can I use the ethernet only for the system and the wifi to continue to navigate the web pages? How can I do that?

Please note: I would like to use both (1) the wifi to navigate and (2) the ethernet for the embedded system AT THE SAME TIME. Separately they work perfectly


Solution 1:

I have a similar setup with an Ubuntu 18.04 LTS with both Ethernet and WiFi connection. The WiFi connects to the router and the Internet. The Ethernet cable connects to a Raspberry Pi.

For Ubuntu 16.04, this answer may be useful: Connecting PC and RaspberryPi using LAN cable

The instructions below are for Ubuntu 18.04

Go to System Setup menu > Network tab on the left margin > The cog icon for the Wired connection as shown below:

enter image description here

Go to the IPv4 tab of the Wired Connection and check the box Use this connection only for resources on its network as shown below.

enter image description here

That was all. I let the desktop assign the IP by DHCP and changed the Pi's setting to request a specific IP address from the desktop. It works for me.

If you manually assign IP addresses then do not specify any Gateway IP address in this setting. A Gateway is not needed in this setup and will confuse the kernel-level packet routing. Thanks Thomas Ward.

Hope this helps

Solution 2:

Thanks to @user68186 I have found the solution on Xubuntu 16.04:

Double click on the network connection (in my case the little symbol of wireless on top-right)

enter image description here

Choose > Edit connection... and select the connection you want to edit (in my case the Wire Connection 1):

enter image description here

From the window that will be open, select the tab IPv4:

enter image description here

Organize the network as you prefer (in my case no DHCP but a P2P connection with a little embedded system and a switch in the middle). Now press Routes on the bottom-right side and select the option Use this connection only for resource on this network:

enter image description here

Press Ok and Save the setup.

The wifi for internet and the ethernet for the P2P are working perfectly at the same time. Thanks @user68186