In Linux, you possibly can create superior community setups akin to Community Bonding or NIC teaming, VLAN tagging, and bridging based mostly in your wants. These superior options enable for elevated community connectivity effectivity and reliability.
You may create VLAN interfaces on prime of one other interface, akin to Ethernet, bond, group, or bridge units.
On this article, we’ll discover ways to configure VLAN tagging over Community Bonding in RHEL system, which permits traffics from completely different networks to share frequent bodily hyperlinks.
Stipulations for tagging VLAN over Bonding:
- The Community group have to allow LACP (802.3ad) on the Community swap ports to combination the hyperlinks.
- The Community group have to configure community port as a trunk port, which permits multiple VLAN to be added to the identical port. Additionally, get the VLAN ID from them to be able to configure at OS stage.
- A Linux system ought to have two interfaces.
- If it’s a bodily server, we advocate configuring bonding between the On-Board and PCI interfaces to keep away from a single level of failure on the community card on the host aspect.
Bonding Kernel Module
Verify if the bonding module is already loaded in your Linux system utilizing the lsmod command.
lsmod | grep -i bonding bonding 12451 0
It could have loaded by default. In any other case, load it utilizing the modprobe command.
modprobe bonding
VLAN tagging Kernel Module
VLAN tagging (802.1q) is a kernel module that enables us to assign a number of IPs from completely different VLAN on the identical Ethernet card (NIC) on Linux servers. Verify if the VLAN module is already loaded in your Linux system utilizing the lsmod command.
lsmod | grep 8021q 8021q 33080 0 garp 14384 1 8021q mrp 18542 1 8021q
It could have loaded by default. In any other case, load it utilizing the modprobe command.
modprobe 8021q
1) LACP Bonding Configuration
We might be configuring LACP (Mode 4 – 802.3ad) based mostly bonding for hyperlink aggregation, which gives elevated bandwidth for bonding interface by combining two interfaces named em1 and p7p1.
1a) Creating Bond Interface
Create a bond interface file 'ifcfg-bond0'
underneath the listing '/and so on/sysconfig/network-scripts/'
.
vi /and so on/sysconfig/network-scripts/ifcfg-bond0 TYPE=Bond DEVICE=bond0 NAME=bond0 BONDING_MASTER=sure BOOTPROTO=none ONBOOT=sure BONDING_OPTS="mode=4 miimon=100 lacp_rate=1" NM_CONTROLLED=no
1b) Configuring First Slave Interface
Configure the primary slave interface 'em1'
that you just wish to deliver into bonding. Please use the proper interface identify as per your setting.
vi /and so on/sysconfig/network-scripts/ifcfg-em1 TYPE=Ethernet BOOTPROTO=none DEVICE=em1 ONBOOT=sure MASTER=bond0 SLAVE=sure
1c) Configuring Second Slave Interface
Configure the second slave interface 'p7p1'
that you just wish to deliver into bonding. Please use the proper interface identify as per your setting.
vi /and so on/sysconfig/network-scripts/ifcfg-p7p1 TYPE=Ethernet BOOTPROTO=none DEVICE=p7p1 ONBOOT=sure MASTER=bond0 SLAVE=sure
Restarting community companies
Restart the community companies to allow the bonding interface or deliver them up utilizing ifup command.
systemctl restart community
2) VLAN tagging over Bonding Interface
LACP Bonding configuration has been accomplished and all interfaces are up and working now. Let’s configure the VLAN tagging over bonding interface by following the under procedures.
As mentioned within the conditions, following are the VLANs which is mapped to the respective Ethernet Card port (em1 & p7p1) and Community swap 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 "/and so on/sysconfig/network-scripts/ifcfg-bond0.221"
and add the next contents.
vi /and so on/sysconfig/network-scripts/ifcfg-bond0.221 DEVICE=bond0.221 BOOTPROTO=none ONBOOT=sure IPADDR=192.168.10.100 NETMASK=255.255.255.0 GATEWAY=192.168.10.1 VLAN=sure NM_CONTROLLED=no
2b) Configuring VLAN 331 to Bond0
Create tagged interface file for VLAN id 331 as "/and so on/sysconfig/network-scripts/ifcfg-bond0.331"
and add the next contents.
vi /and so on/sysconfig/network-scripts/ifcfg-bond0.331 DEVICE=bond0.331 BOOTPROTO=none ONBOOT=sure IPADDR=192.168.20.100 NETMASK=255.255.255.0 GATEWAY=192.168.20.1 VLAN=sure NM_CONTROLLED=no
Restarting community companies
Restart the community companies to allow the bonding interface or deliver them up utilizing ifup command.
systemctl restart community
Confirm VLAN Tagging Configuration
Lastly confirm whether or not the VLAN tagged interface are configured and up & working utilizing the ip command.
Sure, I may see 'bondo.221@bond0'
and 'bon0.331@bond0'
with two completely different IPs and was in a position to entry the system by way of ssh with none issues. So, VLAN tagging works as anticipated.

Conclusion
Congratulations, you might have discovered how you can configure VLAN tagging over LACP bonding on a RHEL system, which listens for 2 VLANs. VLAN tagging will not be restricted to 2 VLANs, a number of VLANs are supported, which you’ll add in line with the community configuration of that VLAN.