Simple internet sharing with NAT linux
From Kenneth Noyens
Revision as of 17:22, 14 February 2010 by Kenneth (talk | contribs) (Nieuwe pagina aangemaakt met 'activate ip forward: <pre> echo 1 > /proc/sys/net/ipv4/ip_forward </pre> Because changes is /proc/ are not saved and will be lost at every reboot you can edit /etc/sy...')
activate ip forward:
echo 1 > /proc/sys/net/ipv4/ip_forward
Because changes is /proc/ are not saved and will be lost at every reboot you can edit /etc/sysctl.conf:
net.ipv4.ip_forward = 1
Now all packets are forwarded without NAT, to enable NAT enter this command:
iptables -t nat -A POSTROUTING -o wan0 -j MASQUERADE
Or make a script that executes before netwerk bring up:
Make a file /etc/network/if-pre-up.d/routing:
iptables -t nat -A POSTROUTING -o wan0 -j MASQUERADE <pre> Make the script executable: <pre> chmod a+x routing