I have PC with windows OS this PC connected to my laptop by network cable and eth0 and My laptop OS is 14.04. also My labtop is connected to my internet ADSL modem via Wifi by wlan0. I want to know how I can make my ubuntu as a router which give this ability to my windows can has a access to internet via the router?


This Solutions used to work on previous version of Ubuntu , you may try it

for the computer the internet is coming from (the LAPTOP) follow these steps:

  1. Open a terminal and type this:

    sudo ifconfig ethX ip

where 'ethX' is the network card that is going to be connected to the second computer and 'ip' is your desired server ip address (Usually is used)

  1. Then configure the NAT as follows:

    sudo iptables -t nat -A POSTROUTING -o wlanX -j MASQUERADE

where 'wlanX ' is the network card that the Internet is coming from, and then:

`sudo echo 1 > /proc/sys/net/ipv4/ip_forward`
  1. Install dnsmasq and ipmasq using apt-get:

sudo apt-get install dnsmasq

  1. Restart dnsmasq:

sudo /etc/init.d/dnsmasq restart

  1. Repeat steps 1 and 2.

  2. Add the line "net.ipv4.ip_forward = 1" to /etc/sysctl.conf

sudo gedit /etc/sysctl.conf

  1. Reboot. (Optional)

For the second computer, follow these steps:

Set the network card ip to: Gateway: Netmask: like the first computer DNS:

REF: http://www.webupd8.org/2009/02/ubuntu-internet-connection-sharing.html

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.