现在的位置: 首页 > 综合 > 正文

how to config vlan in RHEL

2019年03月12日 ⁄ 综合 ⁄ 共 1111字 ⁄ 字号 评论关闭

文/一觉亮天

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

 

抱歉!评论已关闭.