Some interface types can be configured for IEEE 802.1Q VLAN operation by using a virtual interface. On the DANOS vRouter, virtual interfaces for VLANs are called vifs. As the identifier of a vif, you specify the VLAN to which the vif is connected.
Each physical interface can be configured with multiple vifs. Then, like a physical Ethernet interface, each vif can have multiple addresses assigned to it.
VLAN operation as opposed to multinetting
VLANs are identified by a four-byte tag that is inserted at the front of the Layer 2 Ethernet header. Having this additional tag means that interfaces configured for 802.1Q are not compatible with standard Ethernet packets. When considering whether or not to use a VLAN interface, keep the following in mind.
If you are using 802.1Q VLANs, create vif configuration nodes beneath the physical interface and assign the IP address to the vif.
If you are not using 802.1Q but want to have multiple networks on the same physical interface (that is, you want to use multinetting but not VLANs), simply create multiple address configuration nodes directly under the physical interface without using vifs.
Simultaneous Ethernet and 802.1q operation
If your other network devices support it, an Ethernet interface may be used simultaneously as a standard port and an 802.1Q VLAN port. To do this, configure an IP address directly on the physical interface and then define a vif for the interface. Assign the VLAN ID as the vif identifier and configure an IP address for the vif. (This feature may not be compatible with all Ethernet switches; some switches require a physical Ethernet interface to be exclusively either an 802.1Q interface or a standard Ethernet interface.)
Referring to VLAN interfaces in commands
To refer to a vif within an interfaces command, such as show interfaces or set interfaces, specify the whole path to the vif configuration node, as in the following example.
show interfaces dataplane dp0p1p2 vif 40
When referring to the same vif within other commands—for example, enabling RIP on the interface—use the format of if-x.vlan-id, where if-x is the interface type plus the interface identifier (for example, dp0p1p2) and vlan-id is the VLAN ID (and also the identifier of the vif). The following example refers to the vif on VLAN 40 configured under the dp0p1p2 interface.
set protocols rip interface dp0p1p2.40
Example of VLAN interface configuration
This example shows how to configure the R1 router to have a vif for VLAN 40 on the dp0p1p2 Ethernet interface. After configuring this VLAN, the R1 router has the following interfaces:
One interface (dp0p1p1) that is configured as only a standard Ethernet interface. The IP address for this interface is 172.16.0.65.
One interface (dp0p1p2) that is configured as both a physical Ethernet interface and a VLAN interface. The IP address for the physical Ethernet interface is 10.10.30.65. The VLAN interface connects to VLAN 40 (the identifier of the vif) and has an IP address of 10.10.40.65.
NOTE: By default, the VLAN tag is the same as the vif. Only if vlan-id is defined does it override the tag value.
Assign an IP address directly to the dp0p1p1 untagged Ethernet interface.
danos@R1# set interfaces dataplane dp0p1p1 address 172.16.0.65/24
Assign an IP address directly to the dp0p1p2 untagged Ethernet interface.
danos@R1# set interfaces dataplane dp0p1p2 address 10.10.30.65/24
Create the configuration node for the vif. Assign the vif VLAN ID 40. Assign the IP address for the vif.
danos@R1# set interfaces dataplane dp0p1p2 vif 40 address 10.10.40.65/24