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

From Kenneth Noyens
Jump to: navigation, search
(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...')
 
Line 18: Line 18:
 
<pre>
 
<pre>
 
iptables -t nat -A POSTROUTING -o wan0 -j MASQUERADE
 
iptables -t nat -A POSTROUTING -o wan0 -j MASQUERADE
 +
</pre>
 +
 +
Make the script executable:
 
<pre>
 
<pre>
Make the script executable:
 
 
<pre>
 
<pre>
 
chmod a+x routing
 
chmod a+x routing
 
</pre>
 
</pre>

Revision as of 17:23, 14 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:

<pre>
chmod a+x routing