This article is for you if you have internet connection in your Windows and would like to share it with a Linux box as well. To do that your windows machine should have two network cards connected, one for the internet service and the other one to connect to your other machine or to a hub/switch if you want to share it with more computers.


Connect the cables. Once done, you should first enable Internet Connection Sharing on your Windows machine. To do that, right-click your Internet connection and select “Properties“. Then click the “Advanced” tab. Now simply put a tick on the following option:

Allow other network users to connect through this computer’s Internet connection

This should give your Network card the following static IP address: 192.168.0.1. This address will represent the gateway address for the other computers in your LAN to connect to the Internet.

Now, move to your Linux box and use the following command to give it an IP address and a Subnet Mask:

ifconfig eth0 192.168.0.131 netmask 255.255.255.0

The following command is then used to set the default gateway

route add -net default gw 192.168.0.1

Finally, you will need to update your Linux DNS servers file. Get the two DNS servers IPs by typing
Ipconfig /all” In the command prompt of your Windows machine, and then add them to “/etc/resolv.conf” in your Linux using your favorite editor. For instance, to open the file with nano use the following command:

sudo nano /etc/resolv.conf

That’s all, try to test the connection between the two computers by pinging their IP addresses and then test your DNS configuration with any of the following commands from your Linux box:

host google.com
 
nslookup google.com
 
ping google.com

Leave a Reply

Haider’s WebSpace
Welcome to my technical blog. This is where I write, archive and share computer related articles. Subjects vary from posting technical solutions to researching particular topics. Feel free to comment and talk IT!
Sponsored Links
Posts Calendar
September 2010
M T W T F S S
« Feb    
 12345
6789101112
13141516171819
20212223242526
27282930