Sharing Internet Connection
FleetingTable of Contents
1 Sharing internet connection on wlan0 over eth0
1.1 On the host
echo 1 > /proc/sys/net/ipv4/ip_forward
ifconfig eth0 192.168.0.1
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
1.1.1 Possibly add some port forwarding rules to allow the exterior to get access to the internal machine
iptables -A PREROUTING -t nat -i wlan0 -p tcp –dport 80 -j DNAT –to 192.168.0.2:8080
iptables -A FORWARD -p tcp -d 192.168.1.46 –dport 8080 -j ACCEPT
1.2 On the guest
ifconfig eth0 192.168.0.2
route add -net 0.0.0.0 netmask 0.0.0.0 gateway 192.168.0.1 dev eth0