Scripts for creating and deleting NAT interface inside a sliver
authorAndy Bavier <acb@cs.princeton.edu>
Fri, 20 Feb 2009 20:27:28 +0000 (20:27 +0000)
committerAndy Bavier <acb@cs.princeton.edu>
Fri, 20 Feb 2009 20:27:28 +0000 (20:27 +0000)
teardown-nat [new file with mode: 0644]

diff --git a/teardown-nat b/teardown-nat
new file mode 100644 (file)
index 0000000..c1029b4
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+KEY=$1
+ETUN1=natx$KEY
+
+# Remove iptables rules
+/sbin/iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
+/sbin/iptables -D FORWARD -i eth0 -o $ETUN1 -m state --state RELATED,ESTABLISHED -j ACCEPT
+/sbin/iptables -D FORWARD -i $ETUN1 -o eth0 -j ACCEPT
+
+# Get rid of etun devices, only need name of one of them
+echo $ETUN1 > /sys/module/etun/parameters/delif
+
+
+