#!/bin/sh net=$1 saveifs="$IFS" IFS=';' test -f /etc/networks/$net || (echo "unknown network configuration '$net'" >&2 && exit 1) ifdown_post() { return 0 } ifdown_pre() { return 0 } . /etc/networks/$net if [ $enable = 'no' ]; then exit 0; fi #if [ $enable -eq 0 ]; then exit 0; fi ifdown_pre #ip link set dev $dev up for r in $route; do IFS="$saveifs" ip route del $r IFS=';' done for address in $addr do IFS="$saveifs" ip addr del $address dev $dev IFS=';' done # how do we determine if we should bring the link down? # there could be other configurations that also set up IP # addresses. Also, what happens exactly if the primary # ip address is removed, but not the secondary ones also? # for now, just leave the link up, I don't think it hurts # anything ifdown_post