Latest Article

Casbay News

Promotions

Casbay Events

Tips Sharing

aaa

Stay tuned with us

How to Configure 802.1q VLAN Tagging

How to Configure 802.1q VLAN Tagging

How to Configure 802.1q VLAN Tagging on RHEL / CentOS 7/8 & Fedora Interface

VLAN tagging is a way of handling a network port with more than one VLAN. VLAN tagging is use to show which packet VLAN is use for a network medium as packets. In this guide 802.1q VLAN Tagging will built on a RHEL / CentOS / Fedora framework network interface.
In addition to a parent interface, an interface is create to construct a VLAN. As they pass through the network, the VLAN interface marks packets with VLAN ID, and the return packets are unmark.
Before doing any configuration, ensure 8021q module is load.

ensure 8021q module is load
Ensure 8021q module is load

In this example, I’ll configure an enp6s0 interface on the server.

configure an enp6s0 interface on the server.
Configure an “enp6s0” interface on the server.

You can use the network manager command line tool – nmcli to accomplish this or directly edit network configuration files.

Manually Edit Configuration files

Edit the parent interface configuration file and set like below.

Edit parent interface configuration file and set
Edit parent interface configuration file and set

As seen above, we’ve set the interface to come up on boot and we don’t assign IP information here.
Now configure the VLAN interface. The configuration file name should be the parent interface plus a. character plus the VLAN ID number. In my setup, the VLAN ID is 21, and the parent interface is enp6s0, so the configuration file name should be:

configure VLAN interface
Configure VLAN interface

All network configuration information is add into this file.

Network configuration information
network configuration information
Network configuration information

Once the update has made, restart the network service to make adjustments.

restart network
Restart network service

Alternatively, manually bring up the interface.

manually bring up the interface
Network manually bring up the interface

Confirm IP address information for the interface.

Confirm IP address information for the interface
Confirm IP address information for the interface


Using NMCLI Tool

The same configurations can done purely from the command-line interface. For this method, the NetworkManager service should be running.

networkmanager
NetworkManager

Check current network configurations.

Check current network configurations
Check current network configurations

To create an 802.1Q VLAN interface on Ethernet interface enp6s0, with VLAN interface VLAN21 and ID 21, issue a command as follows:

To create an 802.1Q VLAN interface on Ethernet interface
Create an 802.1Q VLAN interface on Ethernet interface

You can then assign an IP address to the VLAN Interface.

assign an IP address to the VLAN Interface
Assign an IP address to the VLAN Interface

To view all the parameters associated with the VLAN created above, issue a command as follows:

view all the parameters associated with the VLAN created above
To view all the parameters associated with the VLAN created above

You have successfully configured VLAN tagging on an interface in RHEL / CentOS or Fedora server.