`
fp_moon
  • 浏览: 977617 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

linux VLAN配置(vconfig) -转

阅读更多

linux VLAN配置(vconfig)

 
1.安装vlan(vconfig)和加载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
======================================================
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) 
分享到:
评论

相关推荐

    嵌入式linux配置vlan

    在进行VLAN配置之前,确保Linux内核支持VLAN是非常重要的。通常情况下,需要在内核配置时启用以下选项: 1. **Network device support** - [ ] Generic VLAN support (CONFIG_VLAN_8021Q) 这个选项是必须的,...

    vconfig源码 vlan源码

    当数据包通过VLAN接口发送时,内核会根据VLAN配置添加或剥离802.1Q标签。 在处理VLAN数据包时,Linux内核采用“硬件辅助”或“软件模拟”的策略。如果硬件支持802.1Q,如大多数现代以太网交换机,标签处理将在硬件...

    vlan_1.9-3ubuntu3_amd64.deb

    vlan_1.9-3ubuntu3_amd64.deb 安装以支持 vlan配置

    vlan.1.7m.tar.gz_ioctl_vconfig source code_vconfig tar.gz_vlan s

    `vconfig`源代码的学习对于理解Linux网络编程,特别是涉及网络接口和VLAN配置的部分非常有价值。它可以帮助我们了解如何使用C语言编写与内核交互的用户空间程序,以及如何处理网络设备的低级操作。源代码中可能包括...

    linux vlan tag

    在Linux系统中,通过软件配置VLAN可以达到类似网络设备上的VLAN功能,从而提高网络管理和安全性。 在SUSE Linux系统中,配置VLAN通常涉及以下几个步骤: 1. **设置基础网络连接**:首先确保你的网络接口(如eth0和...

    vconfig详解

    在“vconfig详解”这个压缩包中,可能包含的资料可能有vconfig命令的使用教程、VLAN技术的深入解析、Linux网络配置案例,以及相关的故障排查方法等内容。这些资料对于理解和使用vconfig以及VLAN技术非常有帮助,特别...

    linux网卡启用trunk模式操作标准

    ### Linux网卡Trunk模式配置详解 #### 一、引言 在Linux环境中,通过配置网卡的Trunk模式,可以实现单个物理网卡承载多个逻辑接口的需求,这对于网络隔离与流量分类具有重要意义。本文将详细介绍如何在CentOS 5.5...

    linux虚拟网络设备之vlan配置详解

    这篇文章将深入探讨Linux下的VLAN配置,包括其基本原理、网络栈结构以及具体配置步骤。 首先,VLAN是在数据链路层(第二层)实现的网络分段技术,它可以将一个物理网络分割为多个逻辑上的独立网络,这些网络之间...

    12-Linux 如何实现 VLAN 1

    在实际应用中,配置 VLAN 需要使用网络配置工具(如 `ifconfig`、`ip` 命令或 `vconfig` 命令)来创建 VLAN 子接口,并设置相应的 VLAN ID。此外,还需要确保交换机配置正确,允许 VLAN 流量通过。对于 KVM 虚拟机,...

    在μClinux环境下实现虚拟局域网.docx

    这里使用的是vconfig-1.6-4.i386.rpm版本,配合μClinux内核2.4.18版本。VLAN的创建允许我们将网络划分为不同的逻辑网络,例如VLAN1和VLAN2,每个VLAN可以有多个IP地址绑定到同一块网卡的不同接口上。 配置步骤大致...

    vlan.rar_vlan_vlan source code

    2. **VLAN配置接口**:Linux提供了命令行工具`vconfig`,用于添加、删除和配置VLAN。这部分代码会实现这些功能,并与内核进行通信,如设置VLAN ID、指定上行链路等。 3. **VLAN数据包处理**:内核在收到数据包后,...

    vconf的安装包

    用于查看Vlan配置的工具,这是安装包可用FTP及各种工具上传至linux使用

    基于LINUX的802.1Q协议分析与应用.pdf

    2. 转发:在多接口环境中,内核会根据VLAN配置决定数据包的转发路径,限制广播和未知单播帧在特定VLAN内部传播。 3. 发送:在发送数据包时,内核会根据VLAN配置添加或移除802.1Q标签,确保数据包被正确路由。 在...

    VLAN简介 作者文章电子版 需要的下载

    VLAN(Virtual Local Area Network,虚拟局域网)是一种网络技术,用于在单一物理局域网...通过有效的VLAN配置,网络管理员可以更有效地控制流量,减少广播风暴,同时增强网络安全,实现不同部门或服务之间的隔离。

    linux下atheros8328初始化及配置过程.pdf

    在深入探讨Linux环境下Atheros AR8328网络芯片的初始化与配置流程前,我们先对Atheros AR8328有一个基本的认识。AR8328是一款高性能、高集成度的千兆以太网交换机芯片,广泛应用于各种网络设备中,包括路由器、NAS...

    Linux网络设备分析

    VLAN(虚拟局域网)用于在单一物理网络上创建多个逻辑网络,`brctl`和`vconfig`工具可用于管理VLAN。网络命名空间提供独立的网络视图,每个空间都有自己的网络接口、路由规则和网络设备,常用于容器和隔离环境。 ...

    测一测 这些网络协议你都掌握了吗?1

    C选项,`vconfig`命令在某些系统中用于创建带有VLAN ID的虚拟接口。D选项,VTEP(Virtual Tunnel End Point)用于VXLAN隧道的封装,不直接用于配置VLAN。 3. **网关与路由器**:网关和路由器的概念容易混淆。A选项...

Global site tag (gtag.js) - Google Analytics