14 SUBNET=`expr match "$VIRTNET" '.*\(/[0-9]*\)'`
21 $IP tunnel add $EGRE mode gre type eth remote $REMOTE key $KEY ttl 64
27 ip link add name $ETUN0 type veth peer name $ETUN1
28 ifconfig $ETUN0 mtu 1458 up
34 brctl addif $BRIDGE $EGRE
35 brctl addif $BRIDGE $ETUN1
38 ### Setup iptables so that packets are visible in the vserver
39 iptables -t mangle -A FORWARD -o $BRIDGE -j MARK --set-mark $SLICEID
41 ### Put a process in the vserver so we can move the interface there
42 su $SLICE -c "sleep 30 &"
43 PID=`su $SLICE -c "pgrep -n sleep"`
44 $IP link set $ETUN0 netns $PID
45 naddress --add --nid $SLICEID --ip ${VIRTIP}${SUBNET}
46 su $SLICE -c "sudo /sbin/ifconfig $ETUN0 ${VIRTIP}${SUBNET} up; sudo /sbin/route add -net $VIRTNET dev $ETUN0"
49 tc qdisc add dev $EGRE root handle 1: htb default 10
50 tc class add dev $EGRE parent 1: classid 1:10 htb rate $RATE ceil $RATE