The following is a configuration example where the OS version in the global zone is Solaris 11.3.
(1) Create a zone
The following example shows how to create NIC in the anet resource when the following non-global zone name is "zone0."
# zonecfg -z zone0 Use 'create' to begin configuring a new zone. zonecfg:zone0> create create: Using system default template 'SYSdefault' zonecfg:zone0> add anet <- Create the anet interface. zonecfg:zone0:anet> set linkname=net1 <- Specify a NIC name in the zone. zonecfg:zone0:anet> set lower-link=net1 <- Specify a physical NIC to connect. zonecfg:zone0:anet> end zonecfg:zone0> add anet <- Create the anet interface. zonecfg:zone0:anet> set linkname=net2 <- Specify a NIC name in the zone. zonecfg:zone0:anet> set lower-link=net2 <- Specify a physical NIC to connect. zonecfg:zone0:anet> end zonecfg:zone0> export <- Check the setting. create -b set zonepath=/system/zones/%{zonename} set autoboot=false set autoshutdown=shutdown set ip-type=exclusive add anet set linkname=net0 set lower-link=auto set configure-allowed-address=true set link-protection=mac-nospoof set mac-address=auto end add anet set linkname=net1 set lower-link=net1 set configure-allowed-address=true set link-protection=mac-nospoof set mac-address=auto end add anet set linkname=net2 set lower-link=net2 set configure-allowed-address=true set link-protection=mac-nospoof set mac-address=auto end zonecfg:zone0> commit <- Register the zone. zonecfg:zone0> exit <- Zone setting is completed. # zoneadm list -vc <- Check if the zone is properly registered. ID NAME STATUS PATH BRAND IP 0 global running / solaris shared - zone0 configured /system/zones/zone0 solaris excl |
(2) Install the zone
You can install the zone using the following steps.
# zoneadm -z zone0 install The following ZFS file system(s) have been created: rpool/VARSHARE/zones/zone0 Progress being logged to /var/log/zones/zoneadm.20180927T092443Z.zone0.install Image: Preparing at /system/zones/zone0/root. Install Log: /system/volatile/install.4117/install_log AI Manifest: /tmp/manifest.xml.DX2y6a SC Profile: /usr/share/auto_install/sc_profiles/enable_sci.xml Zonename: zone0 Installation: Starting ... <snip.> Installation: Succeeded Note: Man pages can be obtained by installing pkg:/system/manual done. Done: Installation completed in 627.854 seconds. Next Steps: Boot the zone, then log into the zone console (zlogin -C) to complete the configuration process. Log saved in non-global zone as /system/zones/zone0/root/var/log/zones/zoneadm.20180927T092443Z.zone0.install # zoneadm list -vc <- Check if the zone is installed properly. ID NAME STATUS PATH BRAND IP 0 global running / solaris shared - zone0 installed /system/zones/zone0 solaris excl |
Note
When a zone is booted for the first time after installation, the zone is in an unconfigured state. Therefore, it is necessary to define an internal zone configuration. Please refer to the manual of Solaris for the definition methods.
(3) Start the zone
Start the zone using the following steps.
# zoneadm -z zone0 boot <- Start the zone. # zoneadm list -vc ID NAME STATUS PATH BRAND IP 0 global running / solaris shared 1 zone0 running /system/zones/zone0 solaris excl <- Check if the zone is started properly. |
(4) Log in to the zone
You can log in to the zone using the following steps:
# zlogin zone0
[Connected to zone 'zone0' pts/2]
Oracle Corporation SunOS 5.11 11.3 September 2017
root@zone0:~# |
(5) Check the interface state
If you check the interface state on the zone, it will be displayed as follows.
root@zone0:~# dladm show-link
LINK CLASS MTU STATE OVER
net2 vnic 1500 up ?
net1 vnic 1500 up ?
net0 vnic 1500 up ? |
(6) Log out of the zone
You can log out of the zone using the following steps:
root@zone0:~# exit
logout
[Connection to zone 'zone0' pts/2 closed] |
(7) Change the network setting
You can change the network setting using the following steps.
In the network setting when the zone name is "zone0," the following example shows how to change the physical NIC in the global-zone to be connected to net1 in the non-global zone from net1 to net3.
# zonecfg -z zone0 zonecfg:zone0> export <- Check the setting. create -b set brand=solaris set zonepath=/system/zones/%{zonename} set autoboot=false set autoshutdown=shutdown set ip-type=exclusive add anet set linkname=net2 set lower-link=net2 set configure-allowed-address=true set link-protection=mac-nospoof set mac-address=auto end add anet set linkname=net1 set lower-link=net1 set configure-allowed-address=true set link-protection=mac-nospoof set mac-address=auto end add anet set linkname=net0 set lower-link=auto set configure-allowed-address=true set link-protection=mac-nospoof set mac-address=auto end zonecfg:zone0> select anet linkname=net1 <- Select the resource. zonecfg:zone0:anet> set lower-link=net3 <- Change the physical NIC to net3. zonecfg:zone0:anet> end zonecfg:zone0> commit <- Register the zone. zonecfg:zone0> exit <- Zone setting is completed. |
See
For more details, see the Solaris manual according to your OS version.