Difference between revisions of "Simple internet sharing with NAT linux"

From Kenneth Noyens
Jump to: navigation, search
Line 21: Line 21:
  
 
Make the script executable:
 
Make the script executable:
<pre>
 
 
<pre>
 
<pre>
 
chmod a+x routing
 
chmod a+x routing
 
</pre>
 
</pre>

Revision as of 16:42, 21 February 2010

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

Make the script executable:

chmod a+x routing