I've installed an isc-dhcp-server on Ubuntu 12.10 and I'm trying to setup a DHCP server on a head node for six worker computers in the local network. The head node itself is a DHCP client receiving the IP-address (on eth0) from an other computer in the network.

IPv4 IP forwarding is enabled on the head node. In /etc/sysctl.conf the following line was added:

net.ipv4.ip_forward = 1

The following rules are set in /etc/rc.local:

/sbin/iptables -P FORWARD ACCEPT
/sbin/iptables --table nat -A POSTROUTING -o eth0 -j MASQUERADE

Furthermore, INTERFACES="eth0" is set in /etc/default/isc-dhcp-server.

The dhcpd.conf file contains (for the moment only one worker computer is in the file):

ddns-update-style none;

default-lease-time 3600;
max-lease-time 7200;


subnet netmask {
  host hostName {
    hardware ethernet macOfHost;
  option subnet-mask;
  option broadcast-address;
  option routers;

The worker node effectively gets the IP address, but it has no internet connection. A ping to is successful, as well as a ping to the computer that serves as a DHCP server for the head node (a ping to The problem doesn't seem to have something to do with DNS as a ping to an IP-address (such as fails.


The network topology is as follows. There is switch connecting a computer (with internet access and running a DHCP server, IP address and 7 other computers. One of these 7 computers gets an IP from the computer. The IP it gets is and the internet on that computer works fine. Now we have a DHCP server running on in order to provide internet access to the other 6 computers, but that fails. They get IP addresses but have no internet access. We are not allowed to modify anything on the node so it should be feasible to make internet work with this setup.

Does someone know what the problem could be?

Output of /sbin/route -n on the client:

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         UG    0      0        0 eth1     U     1000   0        0 eth1   U     1      0        0 eth1

Output of sudo iptables -L -v -n: Chain INPUT (policy ACCEPT 2146 packets, 1551K bytes) pkts bytes target prot opt in out source destination

Chain FORWARD (policy ACCEPT 59 packets, 3762 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 1908 packets, 213K bytes)
 pkts bytes target     prot opt in     out     source               destination

Output of ip ro sh default via dev eth0 proto static dev eth0 scope link metric 1000 dev eth0 proto kernel scope link src metric 1

  • just to be sure: can your router ( ping the outside world? – umläute Jul 23 '13 at 16:03
  • Yes, it can. (10 characters) – user2611216 Jul 23 '13 at 16:13
  • what's the output of /sbin/route -n on the client? – umläute Jul 24 '13 at 7:31
  • what is subnet mask on the 192.168.1.x network? if you are getting an ip of from that network the subnet mask is probably and it looks like you are trying to nat with overlapping subnets. if you change your downstream dhcp config to use a different set of RFC1918 IPS does it work ( for example). – Doon Jul 24 '13 at 14:02
  • The subnet mask of that network is indeed – user2611216 Jul 24 '13 at 14:10

you have to enable forwarding:

sysctl -w net.ipv4.ip_forward=1

the above line will work immediately. but will be gone the next time you reboot your system.

for a persisten setting, put the following into /etc/sysctl.conf (but it will only take effect after rebooting):

| improve this answer | |
  • IP forwarding was already enabled. I've made this more clear in my question now. – user2611216 Jul 23 '13 at 16:06
  • as i said in my answer, just having the line in the config-file will not enable ip-forwarding until the machine is rebooted. what does sysctl net.ipv4.ip_forward output? can the router see the internet? – umläute Jul 23 '13 at 16:08
  • The machine has already been rebooted many times since that line was added. The head node ( can see the internet, the DHCP client of the DHCP server running on that computer cannot. – user2611216 Jul 23 '13 at 16:10
  • Could you show output of the iptables -L -v -n and ip ro sh ? – ALex_hha Jul 23 '13 at 21:13
  • I've put the output in my question. – user2611216 Jul 24 '13 at 14:19

The Ubuntu documentation covers this pretty thoroughly in their connection sharing guide:


| improve this answer | |

per my comments...

You are trying to use the same IPs on both eth0 and eth1..

Change the subnet on eth1 to be something like / and you should be all set.

| improve this answer | |

Everything is working now. It turned out to be a DNS problem; changing the option routers to option routers fixed the issue. Pings must have been blocked somewhere in the network as responses never came through, but surfing in the browser to a specific IP-address was possible, which made me realise that DNS was the problem. Thanks everyone for your help.

| 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.