Small script for setting up NAT on Ubuntu (probably works on other linuxen too)

This commit is contained in:
adamdunkels 2009-05-11 07:01:54 +00:00
parent 900480959b
commit 4855d0325c
1 changed files with 14 additions and 0 deletions

14
tools/setup-nat-ubuntu Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
# Run this script as root ("sudo ./setup-nat-ubuntu"). It has been tested on Ubunru 8.04.
/sbin/iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
/sbin/iptables --append FORWARD --in-interface tun0 -j ACCEPT
/sbin/sysctl -w net.ipv4.conf.default.forwarding=1
/sbin/sysctl -w net.ipv4.conf.all.forwarding=1
/sbin/sysctl -w net.ipv4.ip_forward=1
echo 1 > /proc/sys/net/ipv4/ip_forward