zero-knowledge

openindiana - how to configure a zone

In this short post, we will get a container running on a openindiana host. We will do some things in crossbow, but of the following stuff is just configuring the zone. At the end of this blog post, you will find some links to related pages.

some preparations

Make sure, that you have a free vnic created with dladm to use in the zone or else, we will have no network available. Further, we need a place on the filesystem, where our zone can be created. We need 500MB to 1.5GB of free space.

writing a zone configuration

In the first step, we have to write a zone configuration. You can use zonecfg directly, but it’s better to write it into a textfile and let zonecfg read that file. That way, you can check the configuration into a vcs of your choice.

The config should look like this.

create -b
set zonepath=/zones/zone1
set ip-type=exclusive
set autoboot=false
add net
set physical=zone1
end
commit

With this configuration, we build a zone, which get’s saved in /zones. /zones has to be a zfs partition or else the zone can not be created.

The sixth line sets the network device for the zone to the vnic zone1.

Now we feed the file to zonecfg and let it create zone1.

# zonecfg -z zone1 -f zone1.conf

installation of the zone

The next step is to install the zone with the command:

# zoneadm -z zone1 install

or clone it from a template with

# zoneadm -z zone1 clone template_name

Now we have to wait a bit and can write the next configuration file.

writing a sysidcfg

I wrote a rough post about the sysidcfg already, so take a look there, if you are interested in further details.

For this example, we use the following content.

name_service=NONE
nfs4_domain=dynamic
terminal=xterms
# the password is foobar
root_password=0WMBUdFzAu6qU
security_policy=NONE
network_interface=zone1 {
  primary
  hostname=zone1
  default_route=NONE
  ip_address=192.168.5.3
  netmask=255.255.255.0
  protocol_ipv6=no
}

booting the zone

When the installation process has ended, copy the file to /zones/zone1/root/etc/sysidcfg. This way, the zone can read the file on the first boot and set most of the stuff.

# zoneadm -z zone1 boot

To check if everything gets configured, log into the zone and check the output.

# zlogin -e ! -C zone1

It will take some time until the zone is ready to use, but it should not ask for further details. When the prompt shows, the configuration completed.

Now you can login into the zone and make further adjustments. Some topics will get their own blog entries here, so take a look at the other entries for help too.

links

Here are some links for further details to this topic: