The following procedure describes how to create a VLAN over a datalink by using the dladm command. You can create an IP interface over a VLAN and configure the interface with an IP address by using the ipadm command. For information about the dladm and ipadm commands, see the dladm(1M) and ipadm(1M) man pages.
You can also configure a VNIC with a VLAN ID to host the VLAN traffic. For more information, see How to Configure VNICs as VLANs in Managing Network Virtualization and Network Resources in Oracle Solaris 11.3.
Before You Begin
This procedure assumes that the zones are already created on the system. For information about zone configuration, refer to Chapter 1, How to Plan and Configure Non-Global Zones in Creating and Using Oracle Solaris Zones.
For more information, see Using Your Assigned Administrative Rights in Securing Users and Processes in Oracle Solaris 11.3.
# dladm show-link
# dladm create-vlan -l link -v vid VLAN-link
Specifies the link on which the VLAN interface is being created.
Indicates the VLAN ID number.
Specifies the name of the VLAN, which can also be a meaningful custom name. For information about VLAN names, see Assigning VLAN Names.
# dladm show-vlan
# ipadm create-ip interface
Where interface provides the VLAN name.
# ipadm create-addr -a address interface
This example shows how to create the VLAN configuration that is illustrated in Local Area Network With Three VLANs.
Check the available links and create the VLANs over the specific links.
# dladm show-link LINK CLASS MTU STATE OVER net0 phys 1500 up -- net1 phys 1500 up -- net2 phys 1500 up --
Host A:
# dladm create-vlan -l net0 -v 123 infotech0
Host C:
# dladm create-vlan -l net0 -v 123 infotech0
Host F:
# dladm create-vlan -l net0 -v 456 humres0
Host B:
# dladm create-vlan -l net0 -v 456 humres0
Host D:
# dladm create-vlan -l net0 -v 789 acctg0
Host E:
# dladm create-vlan -l net0 -v 789 acctg0
Display the VLANs created.
# dladm show-vlan LINK VID SVID PVLAN-TYPE FLAGS OVER infotech0 123 -- -- ---- net0 infotech0 123 -- -- ---- net0 humres0 456 -- -- ---- net0 humres0 456 -- -- ---- net0 acctg0 789 -- -- ---- net0 acctg0 789 -- -- ---- net0
This example shows configuring VLANs with zone's anet resource. This example assumes that you have already configured different zones in the system. For more information about configuring zones, see Creating and Using Oracle Solaris Zones.
Assign the VLAN IDs 11 and 12 to ZoneA and ZoneB respectively.
solaris#zonecfg -z ZoneA zonecfg:ZoneA> add anet zonecfg:ZoneA:anet> set linkname=net0 zonecfg:ZoneA:anet> set lower-link=net0 zonecfg:ZoneA:anet> set vlan-id=11 zonecfg:ZoneA:anet> set allowed-address=192.0.2.10/24 zonecfg:ZoneA:anet> set defrouter=192.0.2.1 zonecfg:ZoneA:net> end
solaris#zonecfg -z ZoneB zonecfg:ZoneA> add anet zonecfg:ZoneA:anet> set linkname=net1 zonecfg:ZoneA:anet> set lower-link=net1 zonecfg:ZoneA:anet> set vlan-id=12 zonecfg:ZoneA:anet> set allowed-address=192.0.2.20/24 zonecfg:ZoneA:anet> set defrouter=192.0.2.21 zonecfg:ZoneA:anet> end
Display the VLAN IDs assigned to the zones.
solaris:~# dladm show-vnic LINK OVER SPEED MACADDRESS MACADDRTYPE IDS ZoneA/anet net0 1000 2:8:20:47:8c:85 random VID:11 ZoneB/anet net1 1000 2:8:20:47:8c:85 random VID:12
This example shows how to create the VLAN configuration that is illustrated in VLANs With Zones. This example assumes that you have already configured different zones in the system. For more information about configuring zones, see Creating and Using Oracle Solaris Zones.
Check the available links that can be used for configuring VLANs and then create the VLAN VNICs over the specific links.
root@solaris# dladm show-link LINK CLASS MTU STATE OVER net0 phys 1500 up -- net1 phys 1500 up -- net2 phys 1500 up -- root@solaris# dladm create-vnic -v 101 -l net0 vnic1 root@solaris# dladm create-vnic -v 102 -l net0 vnic2 root@solaris# dladm create-vnic -v 103 -l net0 vnic3 root@solaris# dladm show-vnic LINK OVER SPEED MACADDRESS MACADDRTYPE IDS vnic1 net0 1000 2:8:20:35:b:9a random VID:101 vnic2 net0 1000 2:8:20:fa:94:57 random VID:102 vnic3 net0 1000 2:8:20:51:1c:4a random VID:103
When link information is displayed, the VLANs are included in the list.
root@solaris# dladm show-link LINK CLASS MTU STATE OVER net0 phys 1500 up -- vnic1 vnic 1500 up net0 vnic2 vnic 1500 up net0 vnic3 vnic 1500 up net0
Specify the VLAN IDs 101, 102, and 103 to ZoneA, ZoneB, and ZoneC respectively.
root@solaris# zonecfg -z ZoneA zonecfg:ZoneA> add net zonecfg:ZoneA:net> set physical=vnic1 zonecfg:ZoneA:net> end zonecfg:ZoneA> verify zonecfg:ZoneA> commit zonecfg:ZoneA> exit root@solaris# zoneadm -z ZoneA reboot
root@solaris# zonecfg -z ZoneB zonecfg:ZoneB> add net zonecfg:ZoneB:net> set physical=vnic2 zonecfg:ZoneB:net> end zonecfg:ZoneB> verify zonecfg:ZoneB> commit zonecfg:ZoneB> exit root@solaris# zoneadm -z ZoneB reboot
root@solaris# zonecfg -z ZoneC zonecfg:ZoneC> add net zonecfg:ZoneC:net> set physical=vnic3 zonecfg:ZoneC:net> end zonecfg:ZonCe> verify zonecfg:ZoneC> commit zonecfg:ZoneC> exit root@solaris# zoneadm -z ZoneC reboot
Display the VLAN VNICs assigned to the zones.
root@solaris:~# dladm show-vnic LINK OVER SPEED MACADDRESS MACADDRTYPE IDS ZoneA/vnic1 net0 1000 2:8:20:47:8c:85 random VID:101 ZoneB/vnic2 net0 1000 2:8:20:47:8c:85 random VID:102 ZoneC/vnic3 net0 1000 2:8:20:47:8c:85 random VID:103
Log in to each non-global zone to configure the VLAN with an IP address.
root@solaris:~# zlogin ZoneA root@ZoneA:~# ipadm create-ip vnic1 root@ZoneA:~# ipadm create-addr -a 192.0.2.1 vnic1 vnic1/v4
root@solaris:~# zlogin ZoneB root@ZoneB:~# ipadm create-ip vnic2 root@ZoneB:~# ipadm create-addr -a 192.0.2.5 vnic2 vnic2/v4
root@solaris:~# zlogin ZoneC root@ZoneC:~# ipadm create-ip vnic3 root@ZoneC:~# ipadm create-addr -a 192.0.2.8 vnic3 vnic3/v4
After all the VLANs have been configured with IP addresses, the configuration is complete. The three VLANs are operative and can host traffic for their respective zones.