Difference between revisions of "VLAN 101"

From ArchWiki
Jump to: navigation, search
(Add merge request.)
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
[[Category:Networking]]
 +
{{out of date}}
 +
{{Merge|VLAN}}
 
This post is meant to help others with VLANs using IP commands and stay persistent across reboots.
 
This post is meant to help others with VLANs using IP commands and stay persistent across reboots.
  

Revision as of 03:13, 10 October 2012

Tango-view-refresh-red.pngThis article or section is out of date.Tango-view-refresh-red.png

Reason: please use the first argument of the template to provide a brief explanation. (Discuss in Talk:VLAN 101#)

Merge-arrows-2.pngThis article or section is a candidate for merging with VLAN.Merge-arrows-2.png

Notes: please use the second argument of the template to provide more detailed indications. (Discuss in Talk:VLAN 101#)

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:

https://wiki.archlinux.org/index.php/Arch_Boot_Process. 

And this is how it looks in the /etc/rc.conf:

eth0="dhcp"
eth1="eth1 up"
eth1_1248="eth1.1248 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255"
eth1_1250="eth1.1250 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255"
eth1_1251="eth1.1251 192.168.2.2 netmask 255.255.255.0 broadcast 192.168.2.255"
eth1_1252="eth1.1252 192.168.3.2 netmask 255.255.255.0 broadcast 192.168.3.255"
eth1_1253="eth1.1253 192.168.4.2 netmask 255.255.255.0 broadcast 192.168.4.255"
eth1_1254="eth1.1254 192.168.5.2 netmask 255.255.255.0 broadcast 192.168.5.255"
eth1_1255="eth1.1255 192.168.6.2 netmask 255.255.255.0 broadcast 192.168.6.255"
eth1_1256="eth1.1256 192.168.7.2 netmask 255.255.255.0 broadcast 192.168.7.255"
eth1_1257="eth1.1257 192.168.8.2 netmask 255.255.255.0 broadcast 192.168.8.255"
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!