X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=factory%2Fsetup-nat;fp=factory%2Fsetup-nat;h=0000000000000000000000000000000000000000;hb=b81d4faa0fd65a42ae4a9a0191b4684d3aa7ff62;hp=64be40b65b84468058778c72a1dcd357da10efd9;hpb=8d38d04aebf97cd4f5a9bc8d1c6586b3daef4685;p=vsys.git diff --git a/factory/setup-nat b/factory/setup-nat deleted file mode 100755 index 64be40b..0000000 --- a/factory/setup-nat +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh +x - -IP=/sbin/ip - -SLICE=$1 -SLICEID=`id -u $SLICE` -read KEY - -modprobe etun - -### Setup etun -ETUN0=nat$KEY -ETUN1=natx$KEY -echo $ETUN0,$ETUN1 > /sys/module/etun/parameters/newif -ifconfig $ETUN1 10.0.$KEY.1 up - -/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE -/sbin/iptables -A FORWARD -i eth0 -o $ETUN1 -m state --state RELATED,ESTABLISHED -j ACCEPT -/sbin/iptables -A FORWARD -i $ETUN1 -o eth0 -j ACCEPT - -### Create "grab link" script -GRAB=/vsys/local_grab-$ETUN0 -echo $SLICE > $GRAB.acl -rm -f $GRAB -cat > $GRAB < /sys/class/net/$ETUN0/new_ns_pid -EOF -chmod +x $GRAB - -### Create "delete link" script -DELETE=/vsys/local_delete-$ETUN0 -echo $SLICE > $DELETE.acl -rm -f $DELETE -cat > $DELETE < /sys/module/etun/parameters/delif - -# Clean up files -rm -f $GRAB $GRAB.acl -rm -f $DELETE $DELETE.acl - -EOF -chmod +x $DELETE -