0

I am trying to enable two VLANS in CentOS 7 and following the article of Redhat.

1.Configure the parent interface in /etc/sysconfig/network-scripts/ifcfg-em1, where X is a unique number corresponding to a specific interface, as follows:

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

2.Configure the VLAN interface configuration in the /etc/sysconfig/network-scripts/ directory. The configuration file name should be the parent interface plus a . character plus the VLAN ID number. For example, if the VLAN ID is 192, and the parent interface is em1, then the configuration file name should be ifcfg-em1.192

DEVICE=em1.192
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.1.1
PREFIX=24
NETWORK=192.168.1.0
VLAN=yes

If there is a need to configure a second VLAN, with for example, VLAN ID 193, on the same interface, em1, add a new file with the name em1.193 with the VLAN configuration details.

DEVICE=em1.193
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.2.1
PREFIX=24
NETWORK=192.168.2.0
VLAN=yes

3.Restart the networking service in order for the changes to take effect. As root issue the following command

systemctl restart network

When i do this the network does not work. But if i remove the vlan tagging and just keeping the initial configuration it works again.

  • Not familiar with CentOS configuration, but I'd inspect (and debug) the network settings with ip link, ip addr, ip route etc., and once you got it working, figure out what to put in the configuration files to reach this state. That works much better than randomly trying stuff in the configuration files, restarting and crossing fingers... – dirkt Jul 28 '18 at 11:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.