Go to main content

Managing Network Datalinks in Oracle® Solaris 11.4

Exit Print View

Updated: November 2020
 
 

Using VLANs With Virtualization

VLANs and Oracle Solaris Zones, including Oracle Solaris Kernel Zones, can be combined to set up network virtualization. See the following figure that illustrates this type of configuration.

Figure 10  VLANs With Zones

image:Graphic illustrates VLANs with zones.

For this setup, you create VNICs as VLANs by assigning them VLAN tags or IDs. These VNICs are part of the same L2 broadcast domain as that of the non-global zone. Thus, in the figure, ZoneA, ZoneB, and ZoneC are configured on the host. Their VNICs have corresponding VLAN IDs.

The following two examples show how to configure VLANs and Oracle Solaris zones together. The first uses the method of configuring the anet zone property while the second sets up the configuration by directly creating VNICs. Both examples assume that the switch ports are configured for the VLANs and that zones are already created on the system.

Example 15  Configuring VLANs With Zone's anet Resource
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

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
Example 16  Configuring VNICs as VLANs for Zones

The example proceeds in 3 stages:

  1. Creation of VNICs

  2. Assigning of a VNIC to each zone

  3. Configuring each VNIC's IP interface from inside the specific zone

solaris$ dladm show-link
LINK     CLASS     MTU     STATE     OVER
net0     phys      1500    up        --         
net1     phys      1500    up        --       
net2     phys      1500    up        --        

solaris$ dladm create-vnic -v 101 -l net0 vnic1
solaris$ dladm create-vnic -v 102 -l net0 vnic2
solaris$ dladm create-vnic -v 103 -l net0 vnic3
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

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

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
solaris$ zoneadm -z ZoneA reboot
  

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
solaris$ zoneadm -z ZoneB reboot
  

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
solaris$ zoneadm -z ZoneC reboot

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
  

solaris:~$ zlogin ZoneA
ZoneA:~$ ipadm create-ip vnic1
ZoneA:~$ ipadm create-addr -a 192.0.2.1 vnic1
vnic1/v4

solaris:~$ zlogin ZoneB
ZoneB:~$ ipadm create-ip vnic2
ZoneB:~$ ipadm create-addr -a 192.0.2.5 vnic2
vnic2/v4

solaris:~$ zlogin ZoneC
ZoneC:~$ ipadm create-ip vnic3
ZoneC:~$ ipadm create-addr -a 192.0.2.8 vnic3
vnic3/v4