EanderAlx.org

Linux, Virtualization and whatever I find interesting ...

User Tools


Site Tools


linux:arch_vlan_rcconf

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
blog:linux:arch_vlan_rcconf [18.04.2012 19:04] – [Setup:] eanderalxblog:linux:arch_vlan_rcconf [23.03.2013 18:33] eanderalx
Line 1: Line 1:
 ====== Arch: VLANs in rc.conf ====== ====== Arch: VLANs in rc.conf ======
   * the package vconfig is needed in order to use VLANs   * the package vconfig is needed in order to use VLANs
 +
 +<note important>Deprecated</note>
 +
 ~~READMORE~~ ~~READMORE~~
    pacman -Sy vconfig    pacman -Sy vconfig
Line 23: Line 26:
 #       /proc/net/vlan/config #       /proc/net/vlan/config
 #       /proc/net/vlan/[vlan-device] #       /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() vlan_add()
 { {
- VLAN_PATH="/proc/net/vlan/" 
- VCONFIG_PATH="/usr/sbin/vconfig" 
  if [ -e $VCONFIG_PATH ];then  if [ -e $VCONFIG_PATH ];then
-                if [ ! -e /usr/bin/lsmod ];then + /usr/bin/lsmod | grep 8021q > /dev/null 2> /dev/null
-                        echo "/usr/bin/lsmod not available, unable to check module" +
-                        exit 1 +
-                fi +
-                /usr/bin/lsmod | grep 8021q > /dev/null 2> /dev/null+
  if [ $? == 0 ];then  if [ $? == 0 ];then
  if [ ! -e $VLAN_PATH$1 ];then  if [ ! -e $VLAN_PATH$1 ];then
Line 39: Line 50:
  VLAN_IFACE=`echo $VLANS_DEV | cut -d "." -f1`  VLAN_IFACE=`echo $VLANS_DEV | cut -d "." -f1`
  VLAN_ID=`echo $VLANS_DEV | cut -d "." -f2`  VLAN_ID=`echo $VLANS_DEV | cut -d "." -f2`
-                                ifconfig $VLAN_IFACE up 
  $VCONFIG_PATH add $VLAN_IFACE $VLAN_ID > /dev/null 2> /dev/null  $VCONFIG_PATH add $VLAN_IFACE $VLAN_ID > /dev/null 2> /dev/null
  fi  fi
Line 49: Line 59:
  fi  fi
 } }
-for vlans in ${VLAN_DEVS[@]}; do +vlan_rem() 
- vlan_add $vlans    +
-done+ 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
  
  
linux/arch_vlan_rcconf.txt · Last modified: 23.03.2013 18:34 by eanderalx