Wednesday, December 19, 2012

Internet Sharing

Topologi yang akan dipakai:
Internet (ppp0) ==> Ubuntu gateway ==>> Client PC (wlan0)

Configure internal network card

sudo ip addr add dev wlan0

Configure NAT

sudo iptables -A FORWARD -o ppp0 -i wlan0 -s -m conntrack --ctstate NEW -j ACCEPT
sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -t nat -F POSTROUTING
sudo iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

Save the iptables

sudo iptables-save | sudo tee /etc/iptables.sav
sudo vim /etc/rc.local 
add the following lines before the "exit 0" line:
iptables-restore < /etc/iptables.sav

Enable routing

sudo vim /etc/sysctl.conf
sehingga menjadi:

OK, Setting routing selesai. NEXT, membuat hotspot:
1. System setting -> Network -> Wireless
2. use as hotspot
3. option -> connect automatically
4. wireless security to change password


Post a Comment