In Linux, you can create advanced network setups such as Network Bonding or NIC teaming, VLAN tagging, and bridging based on your needs. These advanced features allow for increased network connectivity efficiency and reliability.
You can create VLAN interfaces on top of another interface, such as Ethernet, bond, team, or bridge devices.
In this article, we will learn how to configure VLAN tagging over Network Bonding in RHEL system, which allows traffics from different networks to share common physical links.
Prerequisites for tagging VLAN over Bonding:
The Network team need to enable LACP (802.3ad) on the Network switch ports to aggregate the links.
The Network team need to configure network port as a trunk port, which enables more than one VLAN to be added to the same port. Also, get the VLAN ID from them in order to configure at OS level.
A Linux system should have two interfaces.
If it’s a physical server, we recommend configuring bonding between the On-Board and PCI interfaces to avoid a single point of failure on the network card on the host side.
Bonding Kernel Module
Check if the bonding module is already loaded on your Linux system using the lsmod command.
It would have loaded by default. Otherwise, load it using the modprobe command.
VLAN tagging Kernel Module
VLAN tagging (802.1q) is a kernel module that allows us to assign multiple IPs from different VLAN on the same Ethernet card (NIC) on Linux servers. Check if the VLAN module is already loaded on your Linux system using the lsmod command.
It would have loaded by default. Otherwise, load it using the modprobe command.
1) LACP Bonding Configuration
We will be configuring LACP (Mode 4 – 802.3ad) based bonding for link aggregation, which provides increased bandwidth for bonding interface by combining two interfaces named em1 and p7p1.
1a) Creating Bond Interface
Create a bond interface file 'ifcfg-bond0' under the directory '/etc/sysconfig/network-scripts/'.
1b) Configuring First Slave Interface
Configure the first slave interface 'em1' that you want to bring into bonding. Please use the correct interface name as per your environment.
1c) Configuring Second Slave Interface
Configure the second slave interface 'p7p1' that you want to bring into bonding. Please use the correct interface name as per your environment.
Restarting network services
Restart the network services to enable the bonding interface or bring them up using ifup command.
2) VLAN tagging over Bonding Interface
LACP Bonding configuration has been completed and all interfaces are up and running now. Let’s configure the VLAN tagging over bonding interface by following the below procedures.
As discussed in the prerequisites, following are the VLANs which is mapped to the respective Ethernet Card port (em1 & p7p1) and Network switch port.
VLAN ID (221), VLAN N/W = 192.168.10.0/24
VLAN ID (331), VLAN N/W = 192.168.20.0/24
2a) Configuring VLAN 221 to Bond0
Create tagged interface file for VLAN id 221 as "/etc/sysconfig/network-scripts/ifcfg-bond0.221" and add the following contents.
2b) Configuring VLAN 331 to Bond0
Create tagged interface file for VLAN id 331 as "/etc/sysconfig/network-scripts/ifcfg-bond0.331" and add the following contents.
Restarting network services
Restart the network services to enable the bonding interface or bring them up using ifup command.
Verify VLAN Tagging Configuration
Finally verify whether the VLAN tagged interface are configured and up & running using the ip command.
Yes, I could see 'bondo.221@bond0' and 'bon0.331@bond0' with two different IPs and was able to access the system via ssh without any problems. So, VLAN tagging works as expected.
Conclusion
Congratulations, you have learned how to configure VLAN tagging over LACP bonding on a RHEL system, which listens for two VLANs. VLAN tagging is not limited to two VLANs, multiple VLANs are supported, which you can add according to the network configuration of that VLAN.
The post How to Configure VLAN Tagging Over Bonding on RHEL first appeared on 2DayGeek.