EanderAlx.org

Linux, Virtualization and whatever I find interesting ...

User Tools


Site Tools


start

Welcome to my Homepage

Here I will collect the things I know or find out.
I'll write about Ubuntu/Arch Linux, Windows, Bash and Perl Scripting, Virtualisation and whatever else that could be interesting.
All I'm going to write here is tested by myself. I don't give a warranty of the functionality on other systems.

If there are questions, suggestions or something else feel free to send me an mail.

I'm also a hobby photographer, for those interested here is a link.

Recent Blog Posts

Arch: VLANs in rc.conf

  • the package vconfig is needed in order to use VLANs
Deprecated

 pacman -Sy vconfig
  • There were several approaches in the Forum to configure VLANs in rc.conf. The Problem is: therefor its necessary to do extensive changes in “/etc/rc.d/network”.
  • After a update its possible that all changes are gone.
  • I wasn't interested in doing multiple changes in “/etc/rc.d/network” after updates.
  • That's why I write my own variant. It's only needed to change two lines.
  • With my Script it's only Possible to add VLAN and not to remove.
  • “vconfig” is designed that after a reboot VLAN interface are not configured.
  • If you want to achieve more, further changes have to include into “/etc/rc.d/network” and I wanted to avoid this.

Setup:

  • First the Script, put it into “/etc/conf.d”.
create_vlans
#!/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
  • Adapt “/etc/rc.d/network” Attention: the changed are gone after update initscripts.
  • Add these lines before the other includes.
# vlan settings
[ -f /etc/conf.d/create_vlans ] && . /etc/conf.d/create_vlans

configure VLANs

  • VLAN interfaces now can be entered in the rc.conf.
  • With “VLAN_DEVS=()” the interfaces were created [Interface.VLAN_ID].
  • Then you can assign an IP-Adresse to the interface. The interface name is “vlan6” for example. This name must not contain “.” or “ ”.

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=


This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
start.txt · Last modified: 20.12.2018 22:14 by eanderalx