The 802.1q Implementation Configuration tool under Vconfig-linux
Copyright NOTICE: You can reprint, reprint, please be sure to hyperlink form to indicate the original source and author information and this statement. Http://windtear.net/archives/2005/07/18/000720.html http://windtear.net/archives/2005/07/18/000720.html
If you have studied/sbin/ifup, you will find that Ifup scripts have vconfig and VLAN support (then Ifup bridge Support patch This script 2005-04-08 19:01 hbridge-linux Eth Ernet bridging) # Ethernet 802.1Q VLAN Support if [-x/sbin/vconfig-a ' ${vlan} ' = ' yes ']; Then if Echo ${device} | Lang=c egrep-v ' (:) ' | Lang=c egrep-q ' eth[0-9][0-9]*/. [0-9] [0-9]? [0-9]? [0-9]? ' ; Then if [!-d/proc/net/vlan]; Then if Modprobe 8021q >/dev/null 2>&1; Then/sbin/vconfig set_name_type dev_plus_vid_no_pad >/dev/null 2>&1 | |
{echo $ "could not set 802.1Q VLAN parameters."}
else echo $ "No 802.1Q VLAN support available in kernel for device ${device}" Exit 1 fi fi vid= "' Echo ${device} | /Lang=c egrep ' eth[0-9]+/. [0-9] [0-9]? [0-9]? [0-9]?$ ' | /lang=c sed ' s/^[a-z0-9]*/.//g;s/^0*//' "physdev=" ' Echo ${device} | /Lang=c egrep ' eth[0-9]+/. [0-9][0-9]? [0-9]? [0-9]?$ ' | /lang=c sed ' s//. [a-z0-9]*$//g ' "Is_available ${physdev} | | {if ["$?" = "1"]; then echo $ "$alias device ${device} does not seem to is present, Delayin
G initialization. " Exit 1 Else Exit 0 fi} # Link on physical device needs to is up
But no IP required check_device_down ${physdev} && {ip-o link set dev ${physdev} up } IF [!-f/proc/net/vlan/${device}]; Then/sbin/vconfig add ${physdev} ${vid} | | {(Logger-p daemon.info-t ifup/$ "error:could not add VLANs ${vid} as ${device} on
Dev ${physdev} "&" & Echo $ "error:could not add VLANs ${vid} as ${device} on Dev ${physdev}" Exit 1} fi if [-f/proc/net/vlan/${device}];
Then case "$REORDER _hdr" in yes|1)/sbin/vconfig Set_flag ${device} 1 1 | | {(Logger-p daemon.info-t ifup/"Warning:vconfig not able to enabl
e Reorder_hdr on ${device} "&" &};; no|0)/sbin/vconfig Set_flag ${device} 1 0 | | {(Logger-p daemon.info-t ifup/$ "warning:vconfig not able to disa
ble reorder_hdr on ${device} "&" &};; Esac fi fi fi vconfig is the Linux 802.1Q VLAN Implementation Configuration Tool Name:vconfig relocations:
(Not relocatable) version:1.6 Vendor:red Hat, Inc. release:2 build Da
Te:sat Feb 2003 06:20:05 AM CST Install date:tue June-04:55:57 PM CST build Host:porky.devel.redhat.com Group:system Environment/base Source rpm:vconfig-1.6-2.src.rpm size:170822 LICENSE:LGPL signature:dsa/sh
A1, Mon Feb 2003 02:05:29 PM CST, Key ID 219180cddb42a60e packager:red Hat, Inc.
url:http://www.candelatech.com/~greear/vlan.html summary:linux 802.1q VLAN Configuration Utility.
Description:the Vconfig program configures and adjusts 802.1q VLAN parameters. /sbin/vconfig/usr/share/doc/vconfig-1.6/usr/share/doc/vconfig-1.6/changelog/usr/share/doc/vconfig-1.6/readme/ usr/share/doc/vconfig-1.6/contrib/usr/share/doc/vconfig-1.6/contrib/cvs/usr/share/doc/vconfig-1.6/contrib/cvs/ Entries/usr/share/doc/vconfig-1.6/contrib/cvs/repository/usr/share/doc/vconfig-1.6/contrib/cvs/root/usr/share/ doc/vconfig-1.6/contrib/readme/usr/share/doc/vconfig-1.6/contrib/vlan_2.2-full.patch/usr/share/doc/vconfig-1.6 /contrib/vlan_2.2-module.patch/usr/share/doc/vconfig-1.6/vlan.html/usr/share/doc/vconfig-1.6/vlan_test.pl/usr/ Share/man/man8/vconfig.8.gz% Vconfig expecting ARGC to be 3-5, inclusive. Was:1 Usage:add [Interface-name] [vlan_id] rem [Vlan-name] Set_flag [Inter Face-name] [flag-num] [0 | 1] set_egress_map [vlan-name] [skb_priority] [Vlan_qos] Set_ingress _map [Vlan-name] [skb_priority] [Vlan_qos] set_name_type [Name-type] * The [interface-name] is the name O
f the Ethernet card that hosts the VLANs you are talking about.
* The vlan_id is the identifier (0-4095) of the VLAN for you are operating on.
* Skb_priority is the priority in the socket buffer (sk_buff).
* Vlan_qos is the 3 bit priority in the VLAN header * Name-type:vlan_plus_vid (vlan0005), Vlan_plus_vid_no_pad (VLAN5), Dev_plus_vid (eth0.0005), Dev_plus_vid_no_pad (eth0.5) * Bind-type:per_device # allows VLAN 5 on eth0 and
Eth1 to be unique.
Per_kernel # Forces VLAN 5 to is unique across all devices. * Flags:1 REORDER_HDR is set, thE VLAN device'll move the Ethernet header around to make it look exactly like a real Ethernet de Vice.
This could help programs such as DHCPD which read the raw Ethernet packet and make assumptions about the Location of bytes. If you don ' t need it, don ' t turn it, because there'll be at least a small performance.
The Default is off. -----> Configure two VLANs on the Eth0 interface if the module is not loaded, the 8021q module will be loaded automatically vconfig add eth0 vconfig add eth0-----> Set parameter REORDER_HDR (default Vconfig set_flag eth0.11 1 1 vconfig set_flag eth0.21 1 1-----> Check out cat/proc/net/vlan/eth0.11 cat/proc/net/ vlan/eth0.21-----> Change Interface Startup profile CD/ETC/SYSCONFIG/NETWORK-SCRIPTS/CP Ifcfg-eth0 ifcfg-eth0.11 perl-pi-e ' s/DEVICE=e Th0/device=eth0.11/g ' ifcfg-eth0.11 cp ifcfg-eth0 ifcfg-eth0.21 perl-pi-e ' s/device=eth0/device=eth0.21/g ' ifcfg-eth0.21 perl-pi-e ' s/ipaddr=/#IPADDR =/g ' ifcfg-eth0 perl-pi-e ' s/netmask=/#NETMASK =/g ' ifcfg-eth0 ...-----> Hand switch This is necessary to change the switch configuration ifdown eth0;ifup eth0;ifup eth0.11;ifup eth0.21-----> Setting automatically loads 8021q modules the next time you start Block Echo Vlan=yes >>/etc/sysconfig/network |