X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=factory%2Fsetup-link;h=cc800ce8701183a867df118d1b754a4f96295b77;hb=da01b364b3c3e91a120037d2fcf0993bfbd26900;hp=6fb4b9e944c12ee1f9db5728fb558f515e7c59c0;hpb=212fd80329013ca85fb88470eeb1144816b68244;p=vsys.git diff --git a/factory/setup-link b/factory/setup-link index 6fb4b9e..cc800ce 100755 --- a/factory/setup-link +++ b/factory/setup-link @@ -1,7 +1,5 @@ #!/bin/sh +x -IP=/sbin/ip - SLICE=$1 SLICEID=`id -u $SLICE` read INDEX @@ -11,17 +9,16 @@ read KEY LINK=${KEY}if${INDEX} modprobe ip_gre -modprobe etun ### Setup EGRE tunnel EGRE=d$LINK -$IP tunnel add $EGRE mode gre/eth remote $REMOTE key $KEY -$IP link set $EGRE up +ip tunnel add $EGRE mode gre type eth remote $REMOTE key $KEY ttl 64 +ip link set $EGRE up ### Setup etun ETUN0=a$LINK ETUN1=b$LINK -echo $ETUN0,$ETUN1 > /sys/module/etun/parameters/newif +ip link add name $ETUN0 type veth peer name $ETUN1 ifconfig $ETUN0 mtu 1458 up ifconfig $ETUN1 up @@ -36,7 +33,7 @@ ifconfig $BRIDGE up iptables -t mangle -A FORWARD -o $BRIDGE -j MARK --set-mark $SLICEID ### Create "grab link" script -GRAB=/vsys/grab-$ETUN0 +GRAB=/vsys/local_grab-$ETUN0 echo $SLICE > $GRAB.acl rm -f $GRAB cat > $GRAB < $GRAB < /sys/class/net/$ETUN0/new_ns_pid +ip link set $ETUN0 netns \$PID EOF chmod +x $GRAB ### Create script for setting link rate -BIND=/vsys/rate-$ETUN0 +BIND=/vsys/local_rate-$ETUN0 echo $SLICE > $BIND.acl rm -f $BIND cat > $BIND < $DELETE.acl rm -f $DELETE cat > $DELETE < /sys/module/etun/parameters/delif +ip link delete dev $ETUN1 # Get rid of bridge ifconfig $BRIDGE down