#! /bin/sh

if [ -z "$1" ]; then
		  echo "usage: $0 interface"
		  exit 2
fi

IF=$1
STATE=$(grep -w $IF < /etc/network/run/ifstate 2>/dev/null)

if [ -z "$STATE" ]; then
		  echo "Unknown interface"
		  exit 1
fi

sudo ifdown $IF
sudo ifup $STATE

