linux VLAN配置(vconfig)
1.安装vlan(vconfig)和加载8021q模块
#aptitude install vlan
#modprobe 8021q
#aptitude install vlan
#modprobe 8021q
或:
#yum install vconfig
#modprobe 8021q
#lsmod |grep -i 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
#modprobe 8021q
#lsmod |grep -i 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
======================================================
VCONFIG(8) VCONFIG(8)
NAME
vconfig - VLAN (802.1q) configuration program.
SYNOPSIS
vconfig [lots of long options]
DESCRIPTION
The vconfig program allows you to create and remove vlan-devices on a vlan enabled kernel. Vlan-devices are virtual ethernet devices
which represents the virtual lans on the physical lan.
OPTIONS
add [interface-name] [vlan-id]
Creates a vlan-device on [interface-name]. The resulting vlan-device will be called according to the nameing convention set.
rem [vlan-device]
Removes the named vlan-device.
set_flag [vlan-device] 0 | 1
When 1, ethernet header reorders are turned on. Dumping the device will appear as a common ethernet device without vlans. When
0(default) however, ethernet headers are not reordered, which results in vlan tagged packets when dumping the device. Usually
the default gives no problems, but some packet filtering programs might have problems with it.
set_egress_map [vlan-device] [skb-priority] [vlan-qos]
This flags that outbound packets with a particular skb-priority should be tagged with the particular vlan priority vlan-qos.
The default vlan priority is 0.
set_ingress_map [vlan-device] [skb-priority] [vlan-qos]
This flags that inbound packets with the particular vlan priority vlan-qos should be queued with a particular skb-priority. The
default skb-priority is 0.
set_name_type VLAN_PLUS_VID | VLAN_PLUS_VID_NO_PAD | DEV_PLUS_VID | DEV_PLUS_VID_NO_PAD
Sets the way vlan-device names are created. Use vconfig without arguments to see the different formats.
NOTES VLAN will use Broadcom’s NICE interface when the network device supports it. This is necessary, since usually the hardware of
these devices already removes the vlan tag from the ethernet packet. The set_flag option on vlan-devices created on such a
physical network device will be ignored. Dumping the network-device will show only untagged(non-vlan) traffic, and dumping the
vlan-devices will only show traffic intended for that vlan, without the tags.
FILES
/proc/net/vlan/config
/proc/net/vlan/[vlan-device]
SEE ALSO
ip(8), ifconfig(8)
AUTHORS
This manual page was written by Ard van Breemen <ard@kwaak.net>
The vlan patch is written by Ben Greear <greearb@candelatech.com>
VCONFIG(8)
(END)
相关推荐
802.1Q VLAN 源码 CentOS 5.4 编译通过
vlan_1.9-3ubuntu3_amd64.deb 安装以支持 vlan配置
vconfig工具源代码,如果感觉加载进程麻烦,直接参考里面的ioctl就可以了
里面收集了vconfig配置vlan的相关资料,大家看看
vconfig源码。实现虚拟网卡实现虚拟网卡
用于查看Vlan配置的工具,这是安装包可用FTP及各种工具上传至linux使用
pytest-vconfig vyper-config lib的Pytest插件包装用法: 根据需要安装此插件pip install -e git+https://github.com/10101010/pytest-vconfig#egg=pytest-vconfig为pytest执行命令提供consul-url,consul-token,...
主要介绍了自动生成linux网卡配置的脚本,因为Linux虚拟机在复制时候网卡信息会更新,所以导致需要重新配置网卡。本脚本功能,第一次添加网卡后,启动虚拟机,然后运行脚本(可以写在启动脚步中),然后根据ifconfig...
全志R16平台编译linux系统V1.0.txt 2017/4/11 13:36 (编译请使用编译android的lichee的选项编译生成的.config文件,不然直接编译会报错!!!!) rootroot@cm-System-Product-Name:/home/wwt/linux_r16$ tar...
自制水龙头-笔测试工具 注意 此仓库是未维护的。 除非收到请求请求,否则在可预见的将来将不会进行任何更改或修复。 我不再使用这些公式,也没有时间将...frogger-取决于Linux vconfig工具 mitmf-python依赖项取决于
说明在linux下如何添加和修改静态路由,有哪些命令可以使用,主要讲解ifconfig, vconfig等用法
linux的ip命令和ifconfig类似,但前者功能更强大,并旨在取代后者。使用ip命令,只需一个命令,你能很轻松地执行一些网络管理任务。ifconfig是net-tools中已被废弃使用的一个命令,许多年前已经没有维护了。iproute2...
Linux命令 网络配置:ifconfig,ip 连通性探测:ping,traceroute,telnet,mtr 网络连接:netstat,ss,nc,lsof 流量统计:ifstat,sar,iftop 交换与路由:arp,arping,vconfig,route 防火墙:iptables,ipset ...
例如,您可以将自己吸引到VLAN的创建中,并使用vconfig在计算机上创建实际的VLAN以进行某些网络测试。 任何供应商均不支持该库,它是通过对网络设备进行反向工程构建的。 实际支持的命令 为了测试什么以及如何进行...
Busybox for Android v1.20.2 Stable built by Linus Yang ... uudecode, uuencode, vconfig, vi, volname, watch, watchdog, wc, wget, which, whoami, whois, xargs, xz, xzcat, yes, zcat, zcip