{{ :supportukraine.gif|}} ====== VLAN: Configuring VLAN-tagging on CentOS 7 with Tux ====== {{en:tux.png |Hey, my name is "Tux"!}} **Did you ever wonder how you can pass tagged VLANs to your //CentOS// system?** \\ \\ Hey, my name is "Tux" and this tutorial will show you how you can pass tagged VLAN traffic directly to your //CentOS// system so the //CentOS// system itself will tag/de-tag the network data packages instead of the according physical/virtual switch. ---- \\ ===== First thoughts ===== In //CentOS//, VLAN interfaces are based on existing network interfaces. \\ Example: Let's say you want to configure a VLAN interface with a VLAN-ID of //100//. In addition let's say one of the existing standard network interface on your //CentOS// system is called ''eth0'' on which its top you want to set the VLAN to. This would mean that your new VLAN interface would be called ''eth0.100'', which would be based on the existing ''eth0'' interface. In this case, the ''eth0'' interface would be the //parent network interface// while the ''eth0.100'' interface would be the //child network interface//. \\ ===== Start of tutorial ===== First it is necessary to load the kernel module ''8021q'' into the kernel: $ modprobe --first-time 8021q To make sure whether the module has been loaded into the kernel, please execute the previous command again, which should return a similiar error message to: \\ ''modprobe: ERROR: could not insert '8021q': Module already in kernel'' \\ For more informations about the kernel module please execute: $ modinfo 8021q Now execute... $ ifconfig ...to find out the according parent network interface name you want to configure the VLAN interface on top of, which sould return something similiar to: \\ ''eth'' \\ or \\ ''ens''. \\ \\ \\ Now inside the directory... \\ ''/etc/sysconfig/network-scripts'' \\ ...open the according file called \\ ''ifcfg-'': \\ $ vi ifcfg- Comment out all content, except the following: \\ \\ ''DEVICE= \\ TYPE=Ethernet \\ BOOTPROTO=none \\ ONBOOT=yes'' \\ \\ Save the file and quit the editor. \\ Now create a new file... \\ $ vi ifcfg-. (e.g. ''ifcfg-ens160.100'') \\ ...and add the following content: \\ \\ ''DEVICE=.'' (e.g. ''DEVICE=ens160.100'') \\ ''BOOTPROTO=none \\ ONBOOT=yes \\ IPADDR= \\ PREFIX= \\ NETWORK= \\ GATEWAY= \\ VLAN=yes'' \\ \\ Save the file and quit the editor. \\ Restart the network service: $ systemctl restart network It is also possible to configure multiple different VLAN //child network interfaces// on top of a single //parent network interface//! \\ ===== End of tutorial ===== \\ \\ Appreciate my work? \\ [[https://www.buymeacoffee.com/fabioU|Buy me a coffee]] {{:buymeacoffee.png|}} or [[https://www.paypal.com/donate/?hosted_button_id=TH8Q3NTJCAJBA|PayPal]] {{:paypal.png|}} \\ \\ **Source(s):** \\ [[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/networking_guide/sec-configure_802_1q_vlan_tagging_using_the_command_line|Red Hat: CONFIGURE 802.1Q VLAN TAGGING USING THE COMMAND LINE]] {{htmlmetatags>metatag-robots=()}}