Difference between revisions of "VLAN 101"

From ArchWiki
Jump to: navigation, search
(Add merge request.)
(rc.d is not supported anymore. VLAN page already have info about setting at boot using netcfg. So redirect this page to VLAN directly)
Line 1: Line 1:
{{out of date}}
This post is meant to help others with VLANs using IP commands and stay persistent across reboots.
I ran into an issue with Arch and VLANs staying persistent across reboots. From what I read from previous posts, one needs to install vconfig to get VLANs working. From my understanding, vconfig has been deprecated and new installs should use the iproute2 package instead of vconfig to get VLANs configured. Iproute2 is good thing to change to. It is supported still, and there might be possible kernel issues in the future since vconfig is no longer supported.
I did not want to write a script to make this work, because I was worried that any updates might overwrite what I was doing. Hence, I added shell commands to the Arch boot process which is located in the /etc/rc.d/functions.d directory . I created a file called vlans, configured the desired commands, and made sure that the proper custom hook was configured to start the VLANs after the physical interface was loaded. Then I configured the interfaces in /etc/rc.conf.
In /etc/rc.d/functions.d directory, I created a vlans file.
vlans() {
ip link add link eth1 name eth1.1248 type vlan id 1248
ip link add link eth1 name eth1.1250 type vlan id 1250
ip link add link eth1 name eth1.1251 type vlan id 1251
ip link add link eth1 name eth1.1252 type vlan id 1252
ip link add link eth1 name eth1.1253 type vlan id 1253
ip link add link eth1 name eth1.1254 type vlan id 1254
ip link add link eth1 name eth1.1255 type vlan id 1255
ip link add link eth1 name eth1.1256 type vlan id 1256
ip link add link eth1 name eth1.1257 type vlan id 1257
add_hook sysinit_udevsettled vlans
The functions/add_hook section is documented here:
And this is how it looks in the /etc/rc.conf:
eth1="eth1 up"
eth1_1248="eth1.1248 netmask broadcast"
eth1_1250="eth1.1250 netmask broadcast"
eth1_1251="eth1.1251 netmask broadcast"
eth1_1252="eth1.1252 netmask broadcast"
eth1_1253="eth1.1253 netmask broadcast"
eth1_1254="eth1.1254 netmask broadcast"
eth1_1255="eth1.1255 netmask broadcast"
eth1_1256="eth1.1256 netmask broadcast"
eth1_1257="eth1.1257 netmask broadcast"
INTERFACES=( eth0 eth1 eth1_1248 eth1_1250 eth1_1251 eth1_1252 eth1_1253 eth1_1254 eth1_1255 eth1_1256 eth1_1257)
This stays persistent across reboots and uses the non-deprecated way of configuring VLANs. Whewhoo!
Hope this saves you some time. Cheers!

Latest revision as of 02:05, 18 February 2013

Redirect to: