Ubuntu – Sharing Connection to other PCs (Via Wired Ethernet)

networking

I have two desktop PCs I use frequently, both running Ubuntu 12.04. One is connected to the internet via wireless, and the other has no wireless card. Is there any way I can share my internet connection across the ethernet ports?

Best Answer

Sharing internet connection via ethernet is one step more than doing it wirelessly. Here are the steps:

PC Sharing Connection

PC that will share connection

  1. Open your Network Manager via the Network Icon on the Unity Panel:

    enter image description here

  2. Go all the way down to the Edit Connections option and click on it.

    enter image description here

  3. You will appear on the Wired Tab. Each Wired connection is by default related to each Ethernet Wired NIC card you have. For example if you have 2 Wired NICs you will see 2 options here. In the image below you see one since this is a Laptop and they normally have one. Select the Wired connection you wish to edit and double click on it or select the EDIT button.

    enter image description here

  4. You will appear on the Wired Tab (Again). This time, go to the IPv4 Settings if you are using IPv4 or IPv6 if you are using that one. On the Method option select Share to Other Computers. Now SAVE. You are done.

enter image description here

This will do all the stuff that was normally done 6 or 7 years ago with all the terminal commands and iptable stuff.

Now just connect the 2 computers and you are done.

NOTE: If both computers have a Wired Gigabit Ethernet NIC then you can actually connect them directly since most 1000BASE-T have automatic MDI/MDI-X. If not just connect them to your switch, router, hub, whatever and that is all.

Client PC

PC That will receive Shared Internet Connection (Depends on Network Setup)

  1. Open your Network Manager via the Network Icon on the Unity Panel:

    enter image description here

  2. Go all the way down to the Edit Connections option and click on it.

    enter image description here

  3. You will appear on the Wired Tab. Each Wired connection is by default related to each Ethernet Wired NIC card you have. For example if you have 2 Wired NICs you will see 2 options here. In the image below you see one since this is a Laptop and they normally have one. Select the Wired connection you wish to edit and double click on it or select the EDIT button.

    enter image description here

  4. You will appear on the Wired Tab (Again). This time, go to the IPv4 Settings if you are using IPv4 or IPv6 if you are using that one. On the Method option select Manual. The options in Addresses will be editable now. Add the IP you want, the Mask you need and the IP of the PC that is sharing the connection. In this case I said that the IP of the Client PC will be 192.168.0.2, the Mask is 255.255.255.0 to imply that is a Class C (LAN) network and 192.168.0.1 to mention that the computer sharing the connection has the IP 192.168.0.1 with it. Additionally add the same IP of the computer sharing the connection to the DNS Servers (As shown in the image).

    enter image description here

You can also (Depending on the network setup) select instead of Manual, select Automatic and just put the IP of the computer sharing the Internet in the DNS Servers section.

enter image description here

Note that this depends on the network setup. For example if you have both PCs connected to a switch or router, the switch/router will take care of the Client, so you only need to setup the PC Sharing Internet and just connect both to the switch/router. If by chance you are connecting the PCs directly together then it is better to do the additional setup of the Client.

In most cases, you will not need to setup the client, just connect to the network and done. Ubuntu will take care of everything. I just added the Client part for specific cases where problems might arise.

This should cover all the possible scenarios in a home LAN when one wants to share the internet connection over Wired cable.

Related Question