-
- for tap in $taps ; do
- # Configuration for this tap (address/proxy)
- eval cfg=\$$tap
- addr=${cfg%/*}
- proxy=${cfg#*/}
-
- # Set MAC address to something predictable
- mac=$(printf 00:FF:%X:%X:%X:%X $(echo $addr | sed -e 's/\./ /g'))
-
- # Bring up this interface. Optimize the MTU for the PlanetLab
- # Backbone (1500/Ethernet - 4/GRE - 8/UDP - 20/IP = 1468).
- ifconfig $tap down && \
- ifconfig $tap hw ether $mac mtu 1468 && \
- ifconfig $tap $addr ${proxy:+pointopoint $proxy} netmask ${tapmask:=255.255.255.255} up
-
- # Stuffing the proxy for this address in the pointopoint field
- # creates a static route to the proxy that we do not want
- # present.
- if [ -n "$proxy" -a "$proxy" != "$addr" ] ; then
- ip route del $proxy
- fi
-
- # Enable route through this interface
- ip route add default dev $tap tab 1 && \
- ip rule add from $addr tab 1
- done
-