Chapter 15. Setting Up VLANs

This chapter takes you through the process of setting up a Virtual Local Area Network (VLAN) interface on a C5 system.

The VLAN feature is implemented according to the IEEE 802.1Q specification. A VLAN allows a system to communicate with other systems using a virtual Ethernet connection, which operates in a similar way as a real Ethernet connection. A VLAN is implemented like a tunnel on a physical connection, using type 0x8100 frames. Multiple VLANs are possible on the same physical interface; they are identified by VLAN tags.

If you do not plan to use VLANs with your system, you may skip this chapter.

15.1.  Basic setup

The support of VLANs is selected through the VLAN configurator feature and the maximum allowed number of VLANs can be configured using the iom.nvlans configurator tunable:

host% cd build_dir
host% configurator -set VLAN=true
host% configurator -set iom.nvlans=2
host% make system_image_name

After booting the new resulting system image, two new Ethernet devices appear, vlan0 and vlan1. In the examples below we assume that the LOCAL_CONSOLE feature has been enabled, and that the console line has been uncommented in the sysadm.ini file, which allows to type C_INIT commands on the system console.

> ifconfig
vlan0: flags=0<> mtu 1500
	ether 00:00:00:00:00:00
	vlan: 0 parent interface: <none>
vlan1: flags=0<> mtu 1500
	ether 00:00:00:00:00:00
	vlan: 0 parent interface: <none>
ifeth0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	inet 129.157.173.214 netmask 0xffffff00 broadcast 129.157.173.255
	ether 08:00:3e:40:00:0c
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384 

Before use, they must be attached to real adapters, and given a VLAN tag, using for example this command:

> ifconfig vlan0 vlan 123 vlandev ifeth0 

which changes the properties of vlan0 as follows:

> ifconfig vlan0
vlan0: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1496
        ether 08:00:3e:40:00:0c
        vlan: 123 parent interface: ifeth0 
[Note]Note
  • Both options (vlan and vlandev) must be passed together, and in this order, for the command to be effective

  • The Ethernet address is inherited from the attached real device

  • The MTU (maximum transmission unit) is smaller by 4 bytes than the real Ethernet value, to accommodate the additional header fields of VLAN Ethernet frames

Finally we have to set an IP address on the virtual adapter:

> ifconfig vlan0 10.0.0.10 up
> ifconfig vlan0
vlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1496
	inet 10.0.0.10 netmask 0xff000000 broadcast 10.255.255.255
	ether 08:00:3e:40:00:0c
	vlan: 123 parent interface: ifeth0 

On another system, but on the same vlan number 123 we can setup a different IP address, e.g. 10.0.0.11 in the same way.

[Note]Note
The second system's Ethernet interface has to be connected to the same network, or can be bridged with the first system's Ethernet network. A VLAN cannot traverse an IP router.

Then we can ping one machine from the other one using the new IP addresses:

> ping 10.0.0.10
started pid = 42
> 10.0.0.10 is alive
ping 10.0.0.11
started pid = 43
> 10.0.0.11 is alive
ping 10.0.0.12
started pid = 44
> no answer from 10.0.0.12 
[Note]Note
The above example shows the actual screen content of the C_INIT-internal ping command. The intermixing between commands and outputs results from the fact that most commands started from a LOCAL_CONSOLE prompt execute asynchronously.