Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

In /etc/network/interfaces the address of the (remote) gateway should not be the same as the address of the local interface.

share|improve this 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!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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