Sometimes you want to to have two computers using the same internet connection. It’s been awhile since I last posted an Ubuntu tutorial, so it is about time. Here I discuss how to share internet access over a crossover cable.
Ok, this config would take less than a minute if I was there. Maybe it will be the same for you if you can cut and paste fast. It can be done graphically and you might want to try it for fun. The fun part about Ubuntu is that you can experiment and there is nothing better than just figuring things out.
Open a terminal and type this:
sudo cp /etc/network/interfaces /etc/network/interfacesbkup
That backed up the file we are going to work with and then this:
sudo gedit /etc/network/interfaces
Now you are going to add the setting for your network. A file will get opened in your editor. Look in the file and you will see this line:
#iface eth0 inet dhcp
Right above it you will see a line that says auto eth0. Don’t touch that line. You want to delete the #iface line and put this in its place:
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.0
This sets the ip address of your LAN connection. Save the file and then exit from gedit.
Now, hook up the cable that goes between your computer and your wife’s computer then just restart networking by typing this in a terminal:
sudo /etc/init.d/networking restart
Now you are ready to use the connection.
1st, do a google search to make sure you have still internet. (IE see something went wrong). It also checks to see if we need to do any default networking.
2nd, is the other computer using Ubuntu or Windows. If the other computer is using Ubuntu as well, just change her /etc/network/interfaces file in the same way I described above, but just change the address, to 192.168.1.2 and add these lines:
gateway 192.168.1.1
dns-nameservers 192.168.1.1
If the other computer is using Windows, go into the TCP/IP properties of the connection and untick the automatically get IP address and auto nameservers. For ip address enter 192.168.1.2 , tab through the mask and for gateway use 192.168.1.1 and for dns, use 192.168.1.1
Now check if the other computer has internet. and check if you have internet. You should both be set.
Problems?
Send me another copy of your ifconfig
If for some reason you lose internet on your Ubuntu, run this command:
sudo rm /etc/network/interfaces
and then
sudo mv /etc/network/interfaces/networkbkup /etc/network/interfaces
When you restart your networking will be back to normal.
I know this is very long, but it is actually very simple, I just have a long explanation. In short, set the networking for eth0 up and then get the other computer set up.