Sharing internet connection

Table of Contents

1 Sharing internet connection on wlan0 over eth0   NOEXPIRYRECURSIVE

nil

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.2 –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

1.3 Adapt the resolv.conf

nil

Author: konubinix

Created: 2015-11-01 dim. 19:07

Emacs 24.3.1 (Org mode 8.2.3c)

Validate