Setting up shared connection
Posted
by
Calvin Froedge
on Ask Ubuntu
See other posts from Ask Ubuntu
or by Calvin Froedge
Published on 2011-11-30T22:27:33Z
Indexed on
2011/12/01
2:19 UTC
Read the original article
Hit count: 421
11.10
|networking
I have a network that is connected to the internet via a switch connected to a router. I have it setup like this so I can work on the new network without causing problems on the old.
Anyway, I'm trying to enable internet connection sharing. Internet comes to server like this:
Modem -> Router -> Switch -> Ubuntu 11.10 (Eth0)
I want to share the connection through Eth1 (Eth1 -> Managed Switch -> Clients). Here is my config for /etc/network/interfaces:
I have a DHCP server running on Eth1. Here is my config:
ddns-update-style none;
option domain-name "myserver.local";
option domain-name-servers 192.168.1.2, 8.8.8.8;
default-lease-time 600;
max-lease-time 7200;
authoritative;
subnet 192.168.1.0 netmask 255.255.255.0 {
interface eth1;
range 192.168.1.3 192.168.1.254;
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
}
Here is /etc/network/interfaces:
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
#Used for internal network
auto eth1
iface eth1 inet static
address 192.168.1.2
netmask 255.255.255.0
broadcast 192.168.1.255
network 192.168.1.0
Here is /etc/hosts:
127.0.0.1 localhost
127.0.1.1 myserver.isp.com server
192.168.1.2 server.myserver.local server myserver.local
In /etc/sysctl.conf, I've set the following:
net.ipv4.ip_forward=1
Finally, in /etc/rc.local, I've set the following:
/sbin/iptables -P FORWARD ACCEPT
/sbin/iptables --table nat -A POSTROUTING -o eth1 -j MASQUERADE
When I ping 8.8.8.8 (google's DNS) from a client that is authenticated with my DHCP server (they have been assigned a local ip, like 192.168.1.10), I get a timeout.
How can I debug this further to figure out where my problem is?
© Ask Ubuntu or respective owner