23

On my Ubuntu 14.04 LTS laptop, I have a LAN connection with a static IP address as well as a WiFi connection to the internet using DHCP. LAN connection goes to a switch and WiFi connection from a WiFi access point.

I need to connect both WiFi and LAN at the same time because I need the LAN for internal connectivity and the WiFi for the Internet. At present, I have to switch off the LAN to connect to the WiFi and vice versa.

Fabby
  • 34,259
  • What for you need to connections at the same time? You need to setup routing to do that. – Pilot6 Jun 21 '15 at 10:31
  • 1
    I need to connect to my intranet which does not have internet connection (ssh) where as wifi is reuired to connect to internet to resolve issues. How I do i do the routing? – wimax-pole Jun 21 '15 at 12:17
  • 1
    Please [edit] your question and add this information there. I am sure someone will guide you. – Pilot6 Jun 21 '15 at 12:19

2 Answers2

20

Step by Step Procedure:

Ubuntu allows multiple connections by default, but sometimes, we need to specify which one to use. In your comments, you have mentioned that you use LAN for the Intranet and WiFi for the Internet.

So, firstly search for Network Connections in the unity dash. Then, under the Ethernet section, click 'Add' button.

enter image description here

Then, we need to create a new Ethernet connection which we are going to enable manually. Uncheck the option of connecting automatically since this is your Intranet connection.

enter image description here

Then go to the IPv4/IPv6 settings (depending on your network) and then click on the Routes button. Check the 'Use this connection only for resources on its network' option. Click Save.

enter image description here

Now you can use both the LAN and WiFi simultaneously.
Source

spharish
  • 425
  • 1
    This answer is correct, although it needs clarification. The old (!) ethernet connection has to be set to "not connect automatically". And then a new one has to be added with "use this connection only for resources on its network". – bomben Dec 17 '16 at 23:22
  • 1
    As the answer suggests I have set the new "Intranet" connection to not automatically connect. To use my Laptop this way I can quickly select this new network. I can still use it normally in other networks. Very nice solution :-) – starbroken Mar 05 '18 at 18:53
  • I wonder how it can be resolved at text mode. That is, how to do it at configuration files and commands? – Stan Huang at Taiwan Apr 17 '22 at 02:36
1

I ran up against a similar problem in my question here: Access wired network camera(s) through a switch without disconnecting from wireless internet

I ended up finding a solution, detailed here: https://askubuntu.com/a/652426/432882

My question was about setting up network cameras on a local "intranet" through a switch, so I think the solution might work for you as well:

  • Launch Network Connections, e.g. by clicking on the network icon at the upper right and choosing "Edit Connections..."
  • Select the "Wired connection #" corresponding to the Ethernet port that will be connected to the switch. Choose "Edit..."
  • Under the IPv4 Settings tab, change the Method drop-down from "Automatic (DHCP)" to "Disabled"
  • Choose "Save..." A duplicate connection may appear in the list; choose "Close" and re-open Network Connections, and the duplicate will be gone (the duplicate item is a bug)
  • Choose "Add", select "Ethernet", and choose "Create..."
  • Type any name, e.g. "Intranet switch"
  • Under the IPv4 Settings tab, change the Method drop-down to "Manual"
  • Choose "Add" next to Addresses, and set Address to some value, either 10.m.n.p (e.g. 10.0.0.9), 172.q.r.s, or 192.168.y.z depending on how your intranet is set up. The address is for the Ubuntu computer, so it should be different from the other addresses on the intranet. See https://en.wikipedia.org/wiki/Private_network#Private_IPv4_address_spaces for details.
  • Set Netmask to 255.255.255.0 and leave Gateway blank.
  • Fill the DNS servers field* with some address, e.g. 10.0.0.10
  • Choose "Save..." and "Close"

Plug the switch into the Ethernet port. The "Intranet switch" connection might connect automatically, or you may have to select it. You should now be connected to the intranet through the switch. Additionally, connecting to the wireless network allows access to the internet via typical URLs. I have not tested this with an intranet that uses URLs for navigation, so you may need to navigate by numerical addresses.

I came upon this solution after watching the following video: https://www.youtube.com/watch?v=yqJ9PXhqOAQ

Theoretically, everything can be undone relatively easily by deleting the "Intranet switch" connection and setting "Wired connection #" from "Disabled" back to "Automatic (DHCP)"

*Please feel free to improve this answer by elaborating on the address in the DNS servers field.

mablem8
  • 491
  • I had the same problem. Needing to reach the internal workshop network with an fixed IP over a wired LAN and in the same time using an external USB 3G adapter to reach the Internet. The problem was that when the wired LAN was connected the USB adapter refused to access the internet. I did what you said: disabled the previous wired LAN, created a new one with manual fixed IP, the only difference being the DNS field where I inserted a fake address (no need for DNS). Now it works BUT I can't understand why. Could any one explain? – Salrandazzo Mar 11 '16 at 14:56