Difference between revisions of "VLAN 101"

From ArchWiki
Jump to: navigation, search
(Created page with "This post is meant to help others with VLANs using IP commands and stay persistent across reboots. Ran into an issue with Arch and VLANs staying persistent across reboots. From ...")
 
(rc.d is not supported anymore. VLAN page already have info about setting at boot using netcfg. So redirect this page to VLAN directly)
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
This post is meant to help others with VLANs using IP commands and stay persistent across reboots.
+
#REDIRECT [[VLAN]]
 
+
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 customer 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, 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 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!
+

Latest revision as of 02:05, 18 February 2013

Redirect to: