Linux VLAN configuration (vconfig) __linux

Source: Internet
Author: User

http://blog.csdn.net/wangwenwen/article/details/13629193

1. Install VLAN (vconfig) and load 8021q modules
#aptitude Install VLAN
#modprobe 8021q or: #yum install Vconfig
#modprobe 8021q
#lsmod |grep-i 8021q
2. Configure VLANs using the Linux vconfig command
#vconfig Add eth0 100
#vconfig Add eth0 200
Configuring two VLANs on the Eth0 interface
#vconfig Set_flag eth0.100 1 1
#vconfig Set_flag eth0.200 1 1
Set the REORDER_HDR parameter of the VLAN, the default is OK.
You can use cat/proc/net/vlan/eth0.100 to view eth0.100 parameters
Configure Network information #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 Delete VLAN command
#vconfig REM eth0.100
#vconfig REM eth0.200
3. Write VLAN information to configuration file
#echo "Modprobe 8021q" >>/etc/rc.local
Boot load 8021q module, or use 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)                                     &NB Sp                    vconfig (8)   NAME       &NBSP;VCO Nfig-vlan (802.1q) configuration program.   Synopsis        vconfig [lots of long options]   DESCRIPTION        th E  vconfig  program allows to the 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 is called according to the Nameing convention set.          rem [Vlan-device]               removes the named VL An-device.          set_flag [Vlan-device] 0 | 1               1, Ethernet header reorders are turned on. Dumping the device would appear as a common Ethernet device without.  when               0 (default)  however,  ethernet headers are not Reord Ered, which results in VLANs tagged packets when dumping the device. Usually               The default gives no problems, but some packet filtering programs Might have problems with it.         &NBSP;SET_EGRESS_MAP [Vlan-device] [skb-priority] [Vlan-qos]         &NBSP ;     This flags so outbound packets with a particular skb-priority should is tagged with the particular  v Lan  priority  vlan-qos.   &NBSp           The default VLAN priority is 0.         &NBSP;SET_INGRESS_MAP [Vlan-device] [skb-priority] [Vlan-qos]         &NBS P     This flags that inbound packets with the particular VLAN priority Vlan-qos should to queued with a particula R 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. Use vconfig without arguments to the different formats.          notes  vlan'll use Broadcom's nice interface when the network device supports it. This is necessary since usually  hardware  of               &NBSP ;d evices  already  removes  the  vlan tag fromThe Ethernet packet. The Set_flag option on vlan-devices created on such a               physical network de Vice would be ignored.  dumping the Network-device'll show Only untagged (Non-vlan) traffic, and dumping the         &N Bsp     Vlan-devices'll traffic intended for that VLAN, without the tags.   FILES        /proc/net/vlan/config        /proc/net/vlan/[vlan-device] & nbsp ALSO       &NBSP;IP (8), Ifconfig (8)   AUTHORS        this manual page was writ Ten by Ard van Breemen <ard@kwaak.net>        the VLAN patch are written by Ben Greear <greear b@candelatech.com>                             &N Bsp                                   &nbsp     Vconfig (8) (end)  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.