#!/bin/sh
## $1=tag, $2-ip, $3-netmask, $4-vlanid

vconfig rem eth0.$4
vconfig rem eth0

if [ $1 -eq 1 ]
  then
    vconfig add eth0 $4
    ifconfig eth0 0.0.0.0 netmask 0.0.0.0
    ifconfig eth0.$4 $2 netmask $3
    ifconfig eth0.$4 promisc
elif [ $1 -eq 0 ]
  then
    ifconfig eth0 up
    ifconfig eth0 $2 netmask $3
fi

echo 'done';

