Sharing internet connection

Table of Contents

1 Sharing internet connection on wlan0 over eth0   NOEXPIRYRECURSIVE

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

Author: konubinix

Created: 2019-03-06 Wed 15:34

Emacs 24.3.1 (Org mode 8.2.3c)