Wednesday, September 23, 2009

Ubuntu Internet Sharing Connection

Scenario: having multiple client, one switch and one eeepc that can connect to the internet through wireless connection.

At Host (the eeepc):
sudo gedit /etc/network/interfaces

copy these
auto eth0
iface eth0 inet static
address 10.8.16.1
netmask 255.255.255.0
broadcast 10.8.16.0
network 10.8.16.0

gsku gedit /etc/sysctl.conf
net.ipv4.conf.default.forwarding=1
sudo apt-get install dhcp3-server
gksu gedit /etc/dhcp3/dhcpd.conf

copy these:
ddns-update-style none;
option domain-name "mynetwork";
option domain-name-servers Nameserver1, Nameserver2;
option routers 10.8.16.1;

default-lease-time 42300;
max-lease-time 84600;
authoritative;

log-facility local7;

subnet 10.8.16.0 netmask 255.255.255.0 {
range 10.8.16.50 10.8.16.150;
}

Nameserver can be found from "cat /etc/resolv.conf"
gksu gedit /etc/default/dhcp3-server
INTERFACES="eth0"

enable ip packet forwarding:
gksu gedit /etc/rc.local
/sbin/iptables -P FORWARD ACCEPT
/sbin/iptables --table nat -A POSTROUTING -o ra0 -j MASQUERADE

No comments:

Post a Comment