• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How To Configure 802.1q VLAN On NIC On CentOS/RHEL 7 and 8

by admin

This note exemplifies how to configure VLAN on bonding network interface on CentOS/RHEL 7 and 8. The configuration of the switch to support VLAN tagging is not covered in this note. You do not need to do anything for configuring native VLAN on CentOS/RHEL, since it only depends on the switch configuration.

1. Check that the module is loaded by running the command:

# lsmod | grep 8021q

2. If the module is not loaded, proceed to run the following command to load it:

# modprobe 8021q

3. Proceed to configure your physical interface in /etc/sysconfig/network-scripts/ifcfg-eth#, below the example:

For example, for eth0:

DEVICE=eth0
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes

4. Configure the VLAN interface script in /etc/sysconfig/network-scripts. The configuration filename must be the physical interface plus a “.” character plus the VLAN id number. For example, if the VLAN id is 10, and the physical network interface is eth0, then the configuration filename should be ifcfg-eth0.10, as the example below:

DEVICE=eth0.10
BOOTPROTO=none
ONBOOT=yes
IPADDR=##.##.##.##
NETMASK=###.###.###.##
USERCTL=no
NETWORK=##.##.##.##
VLAN=yes

For more VLANs required on the same interface, add a new file with the name as in the example above and the VLAN configuration details, for example, eth0.20

5. Restart the network service, in order for the changes to take effect

# systemctl restart network
IMPORTANT: For CentOS/RHEL 7 & 8, the configuration is to be made with the conventional network service and not with NetworkManager service.
CentOS / RHEL 6 : How to configure 802.1q VLAN On NIC
CentOS / RHEL 7 : How to configure VLAN Tagging using nmcli

Filed Under: CentOS/RHEL, CentOS/RHEL 7, CentOS/RHEL 8, Linux

Some more articles you might also be interested in …

  1. Using iostat to monitor system performance in Linux (Examples included)
  2. The System Continuously Displayed the Error Message from the “avahi-demon” in /var/log/messages
  3. The locate Command in Linux
  4. How RHEVM Monitor Storage Health
  5. How to query and modify kernel parameters using sysctl (Immediately and persistently) in CentOS / RHEL
  6. imagemagick for image optimization
  7. How to monitor the Mounting/Umounting of Mount Points Using Auditd on CentOS/RHEL 6,7
  8. CentOS / RHEL 7 : How to extract initramfs image and edit/view it
  9. How To Create a Local Yum Repository for MySQL Enterprise Packages
  10. Linux OS Service ‘nscd’

You May Also Like

Primary Sidebar

Recent Posts

  • JavaFX ComboBox: Set a value to the combo box
  • Nginx load balancing
  • nginx 504 gateway time-out
  • Images preview with ngx_http_image_filter_module

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright