vlan add if_name vlanid ...
vlan delete [ -q ] if_name [ vlanid ... ]
vlan modify [ -g {on|off} ] if_name
vlan stat if_name [ vlanid ]
In the vlan commands, if_name stands for the name of an Ethernet interface. The vlanid is a numerical value between 1 and 4094.
Once created, a VLAN interface is indistinguishable from a physical network interface. You can inspect and modify statistical and configuration information using the ifconfig and netstat commands, among others. An Ethernet interface can be configured to support multiple VLANs with different MTU sizes. One reason to do this would be to enable storage systems and workstations on a high speed gigabit backbone to communicate with each other using large packets on a separate VLAN. Lower speed clients belonging to a VLAN of conventionally-sized Ethernet packets could be connected to the same backbone via 10/100 Mbps switches at the edge of the network. A storage system with a single gigabit interface that supports VLANs would then be able to communicate with devices in either VLAN.
The switch port connected to the storage system must be configured to support the VLANs in which the storage system participates, unless GVRP (GARP VLAN Registration Protocol) has been enabled. If GVRP is configured on the storage system and switch, a VLAN interface is able to dynamically register its vlanids with the switch. This does away with the need to explicitly configure specific VLANs on the switch port.
vlan create e3 10 20
The following example would display statistics for all VLANs associated with interface e3:
vlan stat e3
To display statistics for just VLAN interface e3-20, use the following command:
vlan stat e3 20
Example: An HA pair contains two storage systems, toaster1 and toaster2. toaster1 takes over toaster2 after toaster2 fails.
The /etc/rc file on toaster1 is as follows:
vlan create e0 10 vlan create e1 20 30 ifconfig e0-10 192.9.200.37 ifconfig e1-20 192.9.200.38 partner 192.9.200.41 ifconfig e1-30 partner 192.9.200.42
vlan create e7 30 vlan create e8 10 20 ifconfig e7-30 192.9.200.42 ifconfig e8-20 192.9.200.41 partner 192.9.200.38 ifconfig e8-10 partner 192.9.200.37
The e1-20 VLAN interface on toaster1 is a shared interface. It services requests for address 192.9.200.38 when toaster1 is not in takeover mode. When toaster1 is in takeover mode, the network interface services requests for both addresses, 192.9.200.38 and 192.9.200.41. When toaster1 is in partner mode, this network interface shows up as the e8-20 interface in commands that involve network interface names.
The e1-30 interface on toaster1 is a standby VLAN. It does not service any request when toaster1 is not in takeover mode. However, after toaster1 takes over toaster2, this network interface services requests for address 192.9.200.42. When toaster1 is in partner mode, this network interface shows up as the e7-30 interface in commands that involve network interface names.