文/一觉亮天
A virtual LAN, commonly known as a VLAN, is a group of hosts with a common set of requirements that communicate as if they were attached to the same broadcast
domain, regardless of their physical location. A VLAN has the same attributes as a physical LAN, but it allows for end stations to be grouped together even if they are not located on the same network switch. Network reconfiguration can be done through software
instead of physically relocating devices. [ref-1]
There’re more than one way to configure VLAN In RHEL or CENTOS [ref-2]. Followed a way.
Suppose we have only 1 network interface which is eth0, and we want to configure an IP address with VLAN ID 168. In /etc/sysconfig/network-scripts directory,
configure a fake interface with the name “ifcfg-eth0.168” besides ifcfg-eth0, which 168 is VLAN ID. Execute “service network restart” and then the IP takes effect. Pay attention to DEVICE name and “VLAN=yes”.
Followed config files.
#ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
HWADDR=1C:C1:DE:04:5F:D8
#ifcfg-eth0.168
DEVICE=eth0.168
ONBOOT=yes
VLAN=yes
BOOTPROTO=none
IPADDR=192.168.1.2
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
Reference
[ref-1]http://en.wikipedia.org/wiki/Vlan
[ref-2]http://www.tummy.com/journals/entries/jafo_20061130_063931