pacman -Sy vconfig
#!/bin/bash #FILES # /proc/net/vlan/config # /proc/net/vlan/[vlan-device] # rc.conf: # VLANs # #VLAN_DEVS=(eth0.6) ###### # /etc/rc.d/network # vlan settings #[ -f /etc/conf.d/create_vlans ] && . /etc/conf.d/create_vlans # ### Variables ### LSMOD_PATH="/usr/bin/lsmod" VLAN_PATH="/proc/net/vlan/" VCONFIG_PATH="/usr/sbin/vconfig" # ### Functions ### vlan_add() { if [ -e $VCONFIG_PATH ];then /usr/bin/lsmod | grep 8021q > /dev/null 2> /dev/null if [ $? == 0 ];then if [ ! -e $VLAN_PATH$1 ];then VLANS_DEV=$1 VLAN_IFACE=`echo $VLANS_DEV | cut -d "." -f1` VLAN_ID=`echo $VLANS_DEV | cut -d "." -f2` $VCONFIG_PATH add $VLAN_IFACE $VLAN_ID > /dev/null 2> /dev/null fi else echo "8021q Module not loaded" fi else echo "please install vconfig: pacman -S vconfig" fi } vlan_rem() { vconfig rem $1 } # ### Main ### if [ ! -e $LSMOD_PATH ];then echo "/usr/bin/lsmod not available, unable to check vlan module" else for vlans in ${VLAN_DEVS[@]}; do vlan_add $vlans done fi
# vlan settings [ -f /etc/conf.d/create_vlans ] && . /etc/conf.d/create_vlans
Example:
#VLANs VLAN_DEVS=(eth0.6) interface=eth0 address= netmask= broadcast= gateway= interface=eth0.6 address=172.16.10.1 netmask=255.255.0.0 broadcast=172.16.255.255 gateway=