VNICs can be configured as VLANs. You need to modify the VLAN IDs of VNICs on a datalink when you want the VNICs to host a specific VLAN's traffic.
The dladm subcommand that you use depends on whether you are modifying VLANs or VNICs configured as VLANs:
For VLANs that are created with the dladm create-vlan command, use the dladm modify-vlan command. To display these VLANs, use the dladm show-vlan command.
For VLANs that are created with the dladm create-vnic command, use the dladm modify-vnic command. To display these VNICs, including those with VLAN IDs, use the dladm show-vnic command.
You can modify the VLAN ID of a single VNIC or multiple VNICs that are configured on the datalink. You can also modify the VLAN IDs of VNICs as a group by configuring all the VNICs with the same VLAN ID.
If only one VNIC is configured on the datalink, use the following command syntax to modify the VLAN ID of the VNIC:
$ dladm modify-vnic –v vid –L link
where vid is the new VLAN ID that you assign to the VNIC.
Example 15 Modifying the VLAN ID of a VNIC on a DatalinkIn this example, the VLAN ID of vnic0 that is configured over the datalink net0 is modified.
$ dladm modify-vnic -v 123 -L net0 $ dladm show-vnic LINK OVER SPEED MACADDRESS MACADDRTYPE IDS vnic0 net0 1000 2:8:20:c2:39:38 random VID:123
If multiple VNICs are configured on the datalink, use the following command syntax to modify the VLAN IDs of the VNICs:
$ dladm modify-vnic –v vid VNIC
You must change the VLAN IDs one at a time because each VLAN ID is unique for VNICs on the same datalink.
Example 16 Modifying the VLAN ID of Multiple VNICs on a DatalinkIn this example, the VLAN IDs of vnic0, vnic1, and vnic2 are modified.
$ dladm modify-vnic -v 123 vnic0 $ dladm modify-vnic -v 456 vnic1 $ dladm modify-vnic -v 789 vnic2 $ dladm show-vnic LINK OVER SPEED MACADDRESS MACADDRTYPE IDS vnic0 net0 1000 2:8:20:c2:39:38 random VID:123 vnic1 net0 1000 2:8:20:5f:84:ff random VID:456 vnic2 net0 1000 2:8:20:5f:84:ff random VID:789
If each VNIC is configured on a different datalink, use the following command syntax to modify the VLAN ID of VNICs as a group:
$ dladm modify-vnic –v vid VNIC,VNIC,[...]Example 17 Modifying the VLAN IDs of VNICs as a Group
In this example, the VLAN IDs of vnic0, vnic1, and vnic2 are modified as a group. These VNICs are configured over the datalinks net0, net1, and net2 respectively.
$ dladm modify-vnic -v 123 vnic0,vnic1,vnic2 $ dladm show-vnic LINK OVER SPEED MACADDRESS MACADDRTYPE IDS vnic0 net0 1000 2:8:20:c2:39:38 random VID:123 vnic1 net1 1000 2:8:20:5f:84:ff random VID:123 vnic2 net2 1000 2:8:20:5f:84:ff random VID:123