15 ip tunnel add $EGRE mode gre type eth remote $REMOTE key $KEY ttl 64
21 ip link add name $ETUN0 type veth peer name $ETUN1
22 ifconfig $ETUN0 mtu 1458 up
28 brctl addif $BRIDGE $EGRE
29 brctl addif $BRIDGE $ETUN1
32 ### Setup iptables so that packets are visible in the vserver
33 iptables -t mangle -A FORWARD -o $BRIDGE -j MARK --set-mark $SLICEID
35 ### Create "grab link" script
36 GRAB=/vsys/local_grab-$ETUN0
37 echo $SLICE > $GRAB.acl
44 ip link set $ETUN0 netns \$PID
48 ### Create script for setting link rate
49 BIND=/vsys/local_rate-$ETUN0
50 echo $SLICE > $BIND.acl
57 tc qdisc add dev $EGRE root handle 1: htb default 10
58 tc class add dev $EGRE parent 1: classid 1:10 htb rate \$rt ceil \$rt
66 ### Create "delete link" script
67 DELETE=/vsys/local_delete-$ETUN0
68 echo $SLICE > $DELETE.acl
75 # Remove iptables rule
76 iptables -t mangle -D FORWARD -o $BRIDGE -j MARK --set-mark $SLICEID
78 # Get rid of etun devices, only need name of one of them
79 ip link delete dev $ETUN1
85 # Get rid of EGRE tunnel
90 rm -f $DELETE $DELETE.acl