4

I think i now find myself somewhere between cognitive overload and like a babe lost in the woods. Thus i hope someone out there can assist me! :)

I setup a Ubuntu 12.04 server on my home local network. It's a DHCP / Gateway setup following what seems to be the general idea in a tutorial. The box has two network cards. Internet connection is via PPPOE over a bridged ADSL router. Eth0 is the server's connection to the internet and eth1 is the interface to the lan.

I seem to suffer from the very common issue of the server has internet access (ping URL and IP works), clients on the LAN can ping both network interfaces of the server BUT they cannot ping URL or IP. They do not have internet access.

Thus my request, based on server details further down: How can i give internet access to local network via my server? Or alternatively what small semi-colon-error have i missed in my setup? :P

1. /etc/network/interfaces

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
        address 192.168.1.2
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.1
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 8.8.8.8 192.168.1.1
        dns-search crowdControl.com
auto dsl-provider
iface dsl-provider inet ppp
pre-up /sbin/ifconfig eth0 up # line maintained by pppoeconf
provider dsl-provider
auto eth1
iface eth1 inet static
        address 172.22.22.1
        network 172.22.22.0
        netmask 255.255.255.0

2. /etc/rc.local

/sbin/iptables -A INPUT -i lo -j ACCEPT
/sbin/iptables -A OUTPUT -o lo -j ACCEPT
/sbin/iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -A OUTPUT -m conntrack --ctstate NEW,ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
/sbin/iptables -A FORWARD -i eth1 -j ACCEPT
exit 0

3. /etc/dhcp/dhcp.conf

ddns-update-style none;
option domain-name "crowdControl.com";
option domain-name-servers 8.8.8.8, 192.168.1.1;
default-lease-time 3600;
max-lease-time 7200;
authoritative;
log-facility local7;
subnet 172.22.22.0 netmask 255.255.255.0 {
  range 172.22.22.21 172.22.22.250;
  option routers 172.22.22.1;
  option domain-name-servers 8.8.8.8, 192.168.1.1, 196.220.59.188;
}

4. route -n

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    100    0        0 eth0
172.22.22.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

5. "watch -n 1 -d iptables -nvL" shows packet activity in the FORWARD CHAIN when i do try to ping something on the internet, from a local machine.

6. Pinging 8.8.8.8 from machine on local network results in:

PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 192.168.1.1 icmp_seq=3 Destination Net Unreachable
From 192.168.1.1 icmp_seq=4 Destination Net Unreachable
From 192.168.1.1 icmp_seq=5 Destination Net Unreachable
From 192.168.1.1 icmp_seq=7 Destination Net Unreachable
etc...

PS: I have come across many a similair Q&A but i cannot seem to get my settings to work, even if i try their solutions. Some examples i have found:

2 Answers 2

1

You should follow far4d's advice on net.ipv4.ip_forward... However, you should also do the same thing for net.ipv4.ip_dynaddr.

Simply go to the samre file he told you to edit (/etc/sysctl.conf) and instead of just inserting net.ipv4.ip_forward = 1 instead insert:

net.ipv4.ip_forward = 1
net.ipv4.ip_dynaddrn = 1  

Afterwards, do a sysctl -p as he recomended.

1

Please make sure that forwarding is enabled:

sysctl -n net.ipv4.ip_forward 

This should give you "1". If not, enabled packet forwarding by setting net.ipv4.ip_forward = 1 in /etc/sysctl.conf. Apply the new settings by typing:

sysctl -p 

This will allow you to run a DHCP server or client on the machine, instead of forcing you to actually use fixed address.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .