X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=setup-egre-link;h=e6494af18f028c6e23f0ba24c3b0273fa738be79;hb=f6ed4fcd49097356b5f23143e1df6fc7eb20dcb4;hp=cef410830f5abe718a9006385efe2821fbe6a262;hpb=3511c268d4afb42eb6dc2dc36a0778e104aafc60;p=nodemanager-topo.git diff --git a/setup-egre-link b/setup-egre-link index cef4108..e6494af 100755 --- a/setup-egre-link +++ b/setup-egre-link @@ -9,22 +9,22 @@ REMOTE=$3 KEY=$4 RATE=$5 VIRTIP=$6 +VIRTNET=$7 -VIRTNET=`echo $VIRTIP|sed "s/\.[23]$/.0/"` +SUBNET=`expr match "$VIRTNET" '.*\(/[0-9]*\)'` LINK=${KEY}x${NODEID} modprobe ip_gre -modprobe etun ### Setup EGRE tunnel EGRE=d$LINK -$IP tunnel add $EGRE mode gre/eth remote $REMOTE key $KEY ttl 64 +$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 @@ -39,12 +39,11 @@ ifconfig $BRIDGE up iptables -t mangle -A FORWARD -o $BRIDGE -j MARK --set-mark $SLICEID ### Put a process in the vserver so we can move the interface there -su $SLICE -c "sleep 30" & -sleep 1 -PID=`su $SLICE -c "pgrep sleep"` -chcontext --ctx 1 -- echo $PID > /sys/class/net/$ETUN0/new_ns_pid -sleep 1 -su $SLICE -c "sudo /sbin/ifconfig $ETUN0 $VIRTIP/24 up; sudo /sbin/route add -net $VIRTNET/24 dev $ETUN0" +su $SLICE -c "sleep 30 &" +PID=`su $SLICE -c "pgrep -n sleep"` +$IP link set $ETUN0 netns $PID +naddress --add --nid $SLICEID --ip ${VIRTIP}${SUBNET} +su $SLICE -c "sudo /sbin/ifconfig $ETUN0 ${VIRTIP}${SUBNET} up; sudo /sbin/route add -net $VIRTNET dev $ETUN0" ### Set rate tc qdisc add dev $EGRE root handle 1: htb default 10