Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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 8.8.8.8, 8.8.4.4;
default-lease-time 600;
max-lease-time 7200;
option broadcast-address 10.8.8.255;
subnet 10.8.8.0 netmask 255.255.255.0 {
 range 10.8.8.5 10.8.8.9;
 option routers 10.8.8.1;
}
broadcast-address 10.8.8.255

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
address 10.8.8.1
netmask 255.255.255.0
gateway 10.8.8.1
broadcast 10.8.8.255

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
add comment

2 Answers 2

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
add comment

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
add comment

Your Answer

 
discard

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.