From 4855d0325c9adcf5fdcd028eab1a63bc7a7f9ccd Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Mon, 11 May 2009 07:01:54 +0000 Subject: [PATCH] Small script for setting up NAT on Ubuntu (probably works on other linuxen too) --- tools/setup-nat-ubuntu | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 tools/setup-nat-ubuntu diff --git a/tools/setup-nat-ubuntu b/tools/setup-nat-ubuntu new file mode 100755 index 000000000..8e9d8fe3d --- /dev/null +++ b/tools/setup-nat-ubuntu @@ -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 +