ZoneSetup
|
More Info
Useful Commands
arp -a|grep SP|awk '{print $2}'
Use zoneadm list on the global zone server to show status of zone # /usr/sbin/zoneadm list -vi to show status of all installed zones (i-stands for installed) # /usr/sbin/zoneadm list -vc to show status of all configured zones (c-stands for configured which includes installed zones). Use zonecfg -z <zone name> with the info option to list a specific zone configuration. # zonecfg -z <zone name> info The zonecfg command can be used to list the configuration of a current zone. ** The zonename must be specified. ** |
Configure a Zone
FROM SCRATCH
create -b set zonepath=/opt/zones/test1 set autoboot=true add net set address=172.24.199.23/24 set physical=bge0 end add inherit-pkg-dir set dir=/usr end add inherit-pkg-dir set dir=/lib end add inherit-pkg-dir set dir=/sbin end add inherit-pkg-dir set dir=/platform end add fs set dir=/u1 set special=/u1/test1 set type=lofs end
# zonecfg -z <zone> -f <config_file>
|
FROM EXISTING ZONE
# zonecfg -z sun2q export | sed -e 's/sun2q/sun3q/g' | zonecfg -z sun3q sun3q: No such zone configured Use 'create' to begin configuring a new zone. Ignore the error messages - it worked. You can verify the config by doing "zonecfg -z sun3q export" # zoneadm list -vc ID NAME STATUS PATH 8 sun2q running /opt/zones/sun2q - sun3q configured /opt/zones/sun3q
|
- NOTE - this configures the zone, but does not actually install it. "Installing" means actually setting up the zone operating system & configuration.
Install / Clone New Zone
- There are two approaches to setting up the new zone - Installing or Cloning an existing zone.
INSTALLING
# zoneadm -z oraappd1 install Preparing to install zone <oraappd1>. Creating list of files to copy from the global zone. Copying <2582> files to the zone. Initializing zone product registry. Determining zone package initialization order. Preparing to initialize <1690> packages on the zone. Initialized <1690> packages on zone. Zone <oraappd1> is initialized. Installation of these packages generated errors: <SPROsslnk> Installation of <2> packages was skipped. Installation of these packages generated warnings: <SUNWdtlog> The file </zones/oraappd1/root/var/sadm/system/logs/install_log> contains a log of the zone installation. |
CLONING
# mkdir /u1/sun3q # zoneadm -z sun3q clone sun2q zoneadm: zone 'sun3q': clone operation is invalid for running zones. # zoneadm -z sun2q halt # zoneadm -z sun3q clone sun2q WARNING: network address '172.24.199.17' is configured in both zones. Cloning zonepath /opt/zones/sun2q... |
Automating Initialization of New Zone
At this point it is like a fresh Solaris install. To skip the setup stuff, create a sysidcfg file (as you would for jumpstart) and put it in the etc dir of the zone (in this case /zones/sun2q/root/etc/ directory)
terminal=vt100 network_interface=primary {hostname=<hostname> default_route=<gateway IP> ip_address=<host IP> netmask=255.255.255.0 protocol_ipv6=no} timezone=US/Eastern system_locale=C timeserver=localhost root_password=30can57mYZxCg name_service=DNS {domain_name=<domain.name> name_server=10.0.0.1,10.0.0.2} security_policy=none nfs4_domain=dynamic
Note: A separate module will request the NFSv4 domain parameter used by the nfsmapid command. To complete a hands-off initial zone configuration, edit the file default/nfs, uncomment the NFSMAPID_DOMAIN parameter, and set the domain to the desired NFSv4 domain (see here for details):
# cd /zones/sun2q/root/etc # vi default/nfs (uncomment) NFSMAPID_DOMAIN=domain # touch .NFS4inst_state.domain
Starting the New Zone
Time to fire this puppy up!!
# zoneadm -z sun2q boot
Next, go on the console (use ~. to exit console) and Perform the Internal Zone Configuration if necessary :
# zlogin -C sun2q
If you are having problems, try using failsafe mode
# zlogin -S sun2q
If you didn't setup the NFSv4 domain (see above), the first time you start it up and go to the console you'll see this (go with the default):
- NFSv4 Domain Name ------------------------------------------------------------ NFS version 4 uses a domain name that is automatically derived from the system's naming services. The derived domain name is sufficient for most configurations. In a few cases, mounts that cross domain boundaries might cause files to appear to be owned by "nobody" due to the lack of a common domain name. The current NFSv4 default domain is: "wgresorts.com" NFSv4 Domain Configuration ---------------------------------------------- [X] Use the NFSv4 domain derived by the system [ ] Specify a different NFSv4 domain -------------------------------------------------------------------------------- Esc-2_Continue Esc-6_Help
after which the zone will reboot, and then it's good to go.
rebooting system due to change(s) in /etc/default/init [NOTICE: Zone rebooting] SunOS Release 5.10 Version Generic_125100-09 64-bit Copyright 1983-2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Hostname: reportsq01 reportsq01 console login:
Modifying Zones with ZONECFG
To modify Zones you can use zonecfg. If you use it interactively (i.e. "zonecfg -z <zone>" it's a cisco-like interactive interface (i.e. different levels). You can also just issue commands without using the interactive mode, such as :
# zonecfg -z sun2q info zonename: sun2q zonepath: /opt/zones/sun2q autoboot: true pool: limitpriv: inherit-pkg-dir: dir: /lib inherit-pkg-dir: dir: /platform inherit-pkg-dir: dir: /sbin inherit-pkg-dir: dir: /usr fs: dir: /u1 special: /u1/sun2q raw not specified type: lofs options: [] net: address: 172.24.199.17/24 physical: bge0
You can use zonecfg to change these settings, such as is described here. Often a reboot of the zone will be needed.