how to config vlan in RHEL

文/一觉亮天

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

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值