CentOS: Configure VLAN on interface

Locked
User avatar
Mihai Romania
Posts: 60
Joined: 2023 May 03, 14:12
Location: ROMANIA
Contact:

CentOS: Configure VLAN on interface

Post by Mihai »

Crete the interface ifcfg-eth0.10 configuration file (VLAN 10 on interface eth0)

Code: Select all

[root @ centos ~] touch /etc/sysconfig/network-scripts/ifcfg-eth0.10
Edit the configuration file 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
Add the VLAN with vconfig

Code: Select all

[root @ centos~] vconfig add eth0 10
Added VLAN with VID == 10 to IF -:eth0:-
Restart the network service

Code: Select all

[root @ centos ~] service network restart
or

Code: Select all

[root @ centos ~] /etc/init.d/network restart
Check the interface

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)
I'm on LinkedIn
Locked