linux vlan 配置文件,转-linux VLAN配置(vconfig)

本文详细介绍了如何在Linux系统中安装和配置VLAN。首先,通过aptitude安装vlan工具并加载8021q模块。接着,使用vconfig命令创建并设置VLAN接口,例如eth0.100和eth0.200,并配置IP地址。最后,将VLAN配置写入系统启动文件,并提供删除VLAN的命令。确保网络服务正常运行,实现多VLAN网络环境的构建。
摘要由CSDN通过智能技术生成

FROM: http://www.itwhy.org/2011/07-23/645.html#1

1.安装vlan(vconfig)和加载8021q模块

#aptitude install vlan

#modprobe 8021q

2.使用linux vconfig命令配置vlan

#vconfig add eth0 100

#vconfig add eth0 200

在eth0接口上配置两个VLAN

#vconfig set_flag eth0.100 1 1

#vconfig set_flag eth0.200 1 1

设置VLAN的REORDER_HDR参数,默认就行了。

可以使用cat /proc/net/vlan/eth0.100查看eth0.100参数

#ifconfig eth0 0.0.0.0

#ifconfig eth0.100 192.168.100.50 netmask 255.255.255.0 up

#ifconfig eth0.200 192.168.200.50 netmask 255.255.255.0 up

配置网络信息

#vconfig rem eth0.100

#vconfig rem eth0.200

删除VLAN命令

3.将VLAN信息写入配置文件

#echo "modprobe 8021q">>/etc/rc.local

开机加载8021q模块,或者使用echo "8021q">>/etc/modules

#cp /etc/network/interfaces /etc/network/interfaces.default

#vim /etc/network/interfaces

auto lo eth0

iface lo inet loopback

iface eth0.100 inet static

address 192.168.100.50

netmask 255.255.255.0

iface eth0.200 inet static

address 192.168.200.50

netmask 255.255.255.0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值