RHEL 802.1q / VLAN Tagging
From Brandonhutchinson.com
Contents |
Overview
In this example on a RHEL 5 system, I take an interface that is bonded with mode 6 (balance-alb) and enable 802.1q, or "VLAN tagging." The bonded interface will be a member of two VLANs:
- VLAN 825 with IP address 10.216.16.48 and netmask 255.255.240.0
- VLAN 1100 with IP address 10.216.225.1 and netmask 255.255.240.0
The current interface is bond0 with an IP address of 10.216.16.48 and netmask of 255.255.240.0.
Procedure
Note: Once your network administrator enables 802.1q on the switch, your system will appear to "fall off" the network. It won't know how to handle VLAN tagged-frames until you perform the below steps.
Current boot environment
The following steps will enable 802.1q for your current session. The configuration will not be preserved across reboots.
- Enable the 8021q kernel module.
# modprobe 8021q
- Create a VLAN device on the bond0 interface for both VLANs.
# vconfig add bond0 825 # vconfig add bond0 1100
- Configure the VLAN devices.
# ifconfig bond0.825 10.216.16.48 255.255.240.0 up # ifconfig bond0.1100 10.216.225.1 255.255.240.0 up
Preserving the changes across system boots
To preserve the 802.1 configuration changes across reboots, create appropriate /etc/sysconfig/network-scripts files.
e.g., /etc/sysconfig/network-scripts/ifcfg-bond0.825
DEVICE=bond0.825 IPADDR=10.216.16.49 NETMASK=255.255.240.0 GATEWAY=10.216.16.1 ONBOOT=yes BOOTPROTO=static USERCTL=no VLAN=yes
e.g., /etc/sysconfig/network-scripts/ifcfg-bond0.1100
DEVICE=bond0.1100 IPADDR=10.216.225.1 NETMASK=255.255.240.0 ONBOOT=yes BOOTPROTO=static USERCTL=no VLAN=yes
