CentOS: Configure VLAN on interface
Posted: 2023 May 03, 20:57
Crete the interface ifcfg-eth0.10 configuration file (VLAN 10 on interface eth0)
Edit the configuration file ifcfg-eth0.10
Add the VLAN with vconfig
Restart the network service
or
Check the interface
Code: Select all
[root @ centos ~] touch /etc/sysconfig/network-scripts/ifcfg-eth0.10
Code: Select all
[root @ centos ~] nano /etc/sysconfig/network-scripts/ifcfg-eth0.10
DEVICE=eth0.10
BOOTPROTO=STATIC
IPADDR=192.168.40.1
NETMASK=255.255.255.0
VLAN=yes
ONBOOT=yes
Code: Select all
[root @ centos~] vconfig add eth0 10
Added VLAN with VID == 10 to IF -:eth0:-
Code: Select all
[root @ centos ~] service network restart
Code: Select all
[root @ centos ~] /etc/init.d/network restart
Code: Select all
[root @ centos ~] ifconfig eth0.10
eth0.10 Link encap:Ethernet HWaddr 00:12:34:AB:CD:EF
inet addr:192.168.40.1 Bcast:192.168.40.255 Mask:255.255.255.0
inet6 addr: fe80::21e:8cff:fea7:3ec8/64 Scope:Link
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:15 errors:0 dropped:0 overruns:0 frame:0
TX packets:27 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1176 (1.1 KiB) TX bytes:2174 (2.1 KiB)