Konubinix' opinionated web of thoughts

Sharing Internet Connection


1 Sharing internet connection on wlan0 over eth0

1.1 On the host

echo 1 > /proc/sys/net/ipv4/ip_forward
ifconfig eth0
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
iptables -A FORWARD -p tcp -d –dport 8080 -j ACCEPT

1.2 On the guest

ifconfig eth0
route add -net netmask gateway dev eth0

1.3 Adapt the resolv.conf