Difference between revisions of "Set up Network Address Translation"

From Linuxintro
imported>ThorstenStaerk
imported>ThorstenStaerk
Line 1: Line 1:
To set up NAT ([[network]] address translation), [[open a console]] and enter
+
To set up NAT ([[network]] address translation), [[open a console]] and  
 +
* allow IP traffic forwarding
 
  [[echo]] 1 > /proc/sys/net/ipv4/ip_forward
 
  [[echo]] 1 > /proc/sys/net/ipv4/ip_forward
  iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
+
* tell the kernel to forward traffic to the outgoing interface ''eth0'' and masquerade it, so it will put its own IP address into each packet's header:
 +
  iptables -t nat -A POSTROUTING -o ''eth0'' -j MASQUERADE
  
 
= See also =
 
= See also =

Revision as of 19:57, 14 July 2012

To set up NAT (network address translation), open a console and

  • allow IP traffic forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward
  • tell the kernel to forward traffic to the outgoing interface eth0 and masquerade it, so it will put its own IP address into each packet's header:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

See also