答复: How to configure VLAN in CentOS7
My guess would be that the switch isn’t configured to give you access to VLAN 5 with tagged packets. In that case, there’s no need for you to configure eno1.5
Specifically what are you trying to accomplish by configuring a tagged VLAN interface?
How To Configure VLAN In CentOS7
Hi,
I encountered a problem when creating a VLAN interface according to the Red_Hat_Enterprise_Linux-7-Networking_Guide. I configuered the parent interface ifcfg-eno1 as follows:
DEVICE=eno1
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
And I created a new file named ifcfg-eno1.5, the content is:
DEVICE=eno1.5
BOOTPROTO=none
ONBOOT=yes
IPADDR2.168.81.3
PREFIX$
NETWORK2.168.81.0
VLAN=yes
Then I restarted the network: systemctl restart network
After that I found that I couldn’t connect to the Internet, even couldn’t ping the gateway. I thought it might be I didn’t set the GATEWAY in ifcfg-eno1.5, so I added the GATEWAY2.168.81.254(My local area network gateway), it didn’t work.
Could anybody teach me how to create a VLAN interface in CentOS7, or tell me what’ s wrong with my configuration, more detailed more better.
Thanks
Li yulei
2 thoughts on - How To Configure VLAN In CentOS7
–fmGofcPQHPGXbRl7j4jtHGSVWFAriNvsR
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable
Well, in CentOS 7 the default is to use NetworkManager (but you can go back to “classic” network style if you prefer though) and so nmcli can help you with that (assuming that you want to tag vlan 5 on eno1 :
nmcli con add con-name eno1.5 type vlan dev eno1 id 5 ip4 “192.168.81.3/24”
nmcli con up eno1.5
(please note that the network name eno1.5 can be changed to what you want , and will be used as internal name in “nmcli con show”)
More informations in the nm doc :
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Networking_Guide/ch-Configure_802_1Q_VLAN_Tagging.html
How is your switch configured?
The CentOS configuration you described would only work when you set GATEWAY, and when the port it’s connected to has no VLANs configured for untagged access (or no VLANs that you need to access), and when the VLAN
you DO need to access is tagged.
Are you providing access to one VLAN using tagged packets?