X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=setup-egre-link;h=56771f60175e436912586a1dacd32312e2236059;hb=8b07d3cdcc4cbe4eadc0a06175912666c9775d6d;hp=829756df572993dda9d74493758319d1baa6f509;hpb=e4d85917a4dc6fe4cd3dd55abb8eb1f957468d15;p=nodemanager-topo.git diff --git a/setup-egre-link b/setup-egre-link index 829756d..56771f6 100755 --- a/setup-egre-link +++ b/setup-egre-link @@ -9,41 +9,28 @@ REMOTE=$3 KEY=$4 RATE=$5 VIRTIP=$6 +VIRTNET=$7 +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 -ifconfig $ETUN0 mtu 1458 up -ifconfig $ETUN1 up - -### Setup bridge -BRIDGE=c$LINK -brctl addbr $BRIDGE -brctl addif $BRIDGE $EGRE -brctl addif $BRIDGE $ETUN1 -ifconfig $BRIDGE up - -### Setup iptables so that packets are visible in the vserver -iptables -t mangle -A FORWARD -o $BRIDGE -j MARK --set-mark $SLICEID +### Setup macvlan +MACV=a$LINK +ip link add link $EGRE $MACV type macvlan ### Put a process in the vserver so we can move the interface there -su $SLICE -c "sleep 60" & -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" +su $SLICE -c "sleep 30 &" +PID=`su $SLICE -c "pgrep -n sleep"` +$IP link set $MACV netns $PID +naddress --add --nid $SLICEID --ip ${VIRTIP}${SUBNET} +su $SLICE -c "sudo /sbin/ifconfig $MACV ${VIRTIP}${SUBNET} mtu 1458 up" ### Set rate tc qdisc add dev $EGRE root handle 1: htb default 10