Ubuntu – DHCP working but clients don’t have internet


Just as the title says. My DHCP assigns IP addresse and all that stuff to clients; however clients don't have access to the Internet. Here's my DHCP configuration:

ddns-update-style none;
option domain-name "home.lan";
option domain-name-servers,;
default-lease-time 600;
max-lease-time 7200;
option broadcast-address;
subnet netmask {
 option routers;

I have of course added INTERFACES="eth0" in /etc/default/isc-dhcp-server
and added eth0 interface definition to /etc/network/interfaces

auto eth0
iface eth0 inet static

I've added net.ipv4.ip_forward=1 in /etc/sysctl.conf

On the net, I've read that it is possible to simply share the net using linux GUI.
(here's easy guide with screenshots on how to share the connection)
But it doesn't work in my case. If I change on my wlan0 (auto DHCP) to (share to other computers) I don't have internet access after rebooting because wlan0 do not automatically get connection info.

Clients receive IP, default gateway, DNS'es, netmask and so.
Mind any of u helping me with finding out, why it is not working?
Im using ubuntu 12.04. Thanks.

Best Answer

  • Your first steps look fine, but you also have to setup IP masquarding(NAT) using iptables.

    Issue the following commands:

    iptables --table nat --append POSTROUTING --out-interface ethX -j MASQUERADE
    iptables --append FORWARD --in-interface eth0 -j ACCEPT

    That assumes that eth0 is your local LAN and ethX is your external interface(inet). I also suggest you put these commands into a init script, since they are volatile, the iptables rules are lost after a reboot.

    Before you continue i suggest you Google for "Ubuntu NAT", there are a lot of solutions for that problem with ready to use scripts.

    Good luck!