Go to main content

Creating and Using Oracle® Solaris Zones

Exit Print View

Updated: August 2019
 
 

Displaying Zone-Related Information

From the global zone, you can use the zoneadm, zonecfg, or zlogin command to display information about the zones. Each command displays different data about the zones. You must be a zone administrator to run these commands. If necessary, switch to a profile shell.


Tip  - From any zone, use the zonename command to display the name of the zone.

Using the zoneadm Command

The zoneadm list subcommand provides you information about the status of zones on the system.

global$ zoneadm list -cv
ID NAME     STATUS    PATH                  BRAND     IP
0  global   running   /                     solaris   shared
1  zoneA    running   /export/zones/zoneA   solaris   exclusive
2  zoneB    running   /system/zones/zoneB   solaris   exclusive

The output of the command indicates the following about a zone's status.

  • configured: Zone has been created, but no further action has been done. The zone will not have an ID.

  • incomplete: An error occurred during the installation process.

  • installed: Zone has been installed but not booted. The zone will not have an ID.

  • running: Zone is booted and operational. Only a running zone is assigned an ID.

    A non-global zone's ID is not permanent. It changes every time the zone is rebooted. However, the global zone's ID is always zero.

Note also the different paths for zoneA and zoneB in the preceding example. If the zonepath property is not explicitly defined, as in the case of zoneB, then the path is set automatically to /system/zones/zonename based on the template.

Using the zonecfg Command

The zonecfg info command is used to display a zone's properties and resources. Use the following syntax:

global$ zonecfg -z zonename info [property]|[-a]

Without the –a option, the command displays selected configured properties of the zone if you do not specify a specific property.

global$ zonecfg -z zoneA info
zonename: zoneA
brand: solaris
autoboot: true
net:
    physical=net1
anet:
    linkname: net0
    configure-allowed-address: true
    auto-mac-address: MACaddress
global$

If you add the –a option, then all the configurable properties of the zone are displayed, including those that have not been set.

global$ zonecfg -z zoneA info -a
zonename: zoneA
zonepath: /export/zones/zoneA
brand: solaris
autoboot: true
autoshutdown: shutdown
bootargs:
file-mac-profile:
pool:
limitpriv:
scheduling-class:
ip-type: exclusive
hostid:
hwprovider:
fs-allowed:
net:
    address:
    allowed-address:
    configure-allowed-address:
    physical=net1
    defrouter
anet:
        linkname: net0
        lower-link: auto
        allowed-address:
        configure-allowed-address: true
        defrouter:
        allowed-dhcp-cids:
        link-protection: mac-nospoof
        mac-address: auto
        auto-mac-address: MACaddress
        mac-prefix:
...
global$

You can display the same property information about a zone while in interactive configuration:

global$ zonecfg -z zoneA
zonecfg:zoneA> info [property]
selected configured properties

zonecfg:zoneA> info -a
all configurable properties
zonecfg:zoneA>

Using the zlogin Command

To display information about a zone's internal configuration, you would typically log in to the zone and then issue the appropriate Oracle Solaris commands. However, with zlogin, you can run these commands directly from the global zone. Use the following syntax:

global$ zlogin zonename command

The following example shows the network IP configuration of zoneA.

global$ zlogin zoneA ipadm
NAME        CLASS/TYPE   UNDER   ADDR
lo0         loopback     ---      --
lo0/v4   static            ---      127.0.0.1/8
lo0/v6   static            ---      ::1/128
global$

The following example displays the computer or host name of zoneA.

global$ zlogin zoneA hostname
system1

The following example shows user home directories in zoneA.

global$ zlogin zoneA ls /export/home
jdoe
jsmith

For more information about the use of the zlogin command, see the zlogin(1) man page.