I recently discovered a need to be able to add multiple VLANs on a single interfaces on Solaris.
This one is really simple! Just make sure you are running as root, not escalating privileges with pfexec.
So, lets start this off. Figure out which of your interfaces you want to use as the trunk, in my case it is atge0. Make sure that you have setup whichever switchport on your switch to be a dot1q trunk
In this scenario I have my server originally on a switchport just in access mode on VLAN 10. To make it into a trunk (network will drop for around 30 seconds) you can reconfigure the port with the commands below to still be on VLAN 10 if using Cisco.
taiter-sw# configure terminal Enter configuration commands, one per line. End with CNTL/Z. taiter-sw(config)# interface gi0/5 taiter-sw(config-if)# switchport taiter-sw(config-if)# switchport trunk encapsulation dot1q taiter-sw(config-if)# switchport trunk native vlan 10 taiter-sw(config-if)# switchport mode trunk taiter-sw(config-if)# end
Then issue the following commands (substituting your NIC for where I've put atge0):
root@taiter:~# dladm create-vnic -l atge0 -v 30 atge0.30
The argument for the VLAN is -v VLANID and then you can call your new virtual interface whatever you like. I tend to like the INTERFACE.VLAN naming.
Now we can give an IP to the new VNIC.
root@taiter:~# ifconfig atge0.30 plumb 10.1.1.5/24 up
I've just shown an example, but obviously change 10.1.1.5/24 to your IP and mask that is on that VLAN.