sign in
Home | Updates | Pages | Users | Admin | Help

solzones

Solaris Zones

Configuring a Non-Global Zone

root@sol# zonecfg -z zone100
zone100: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:zone100> create
zonecfg:zone100> set zonepath=/opt/zones/zone100
zonecfg:zone100> add inherit-pkg-dir
zonecfg:zone100:inherit-pkg-dir> set dir=/opt
zonecfg:zone100:inherit-pkg-dir> end
zonecfg:zone100> add net
zonecfg:zone100:net> set physical=lo0
zonecfg:zone100:net> set address=127.0.0.100
zonecfg:zone100:net> end
zonecfg:zone100> verify
zonecfg:zone100> commit
zonecfg:zone100> 

In order to talk to the zone you need to route add 127.0.0.100 127.0.0.1 in the global zone.

Installing and Booting a Non-Global Zone

# zoneadm -z zone100 install
# zoneadm -z zone100 boot
# zlogin -C -e \@ zone100

-C parameter is for system console. Will ask questions for the zone name, DNS etc. and restart it one time. Console type: xterm. -e parameter – change the escape character. The default one is ~*, but pressing it will disconnect you from the system itself, not from the zone. Exit from the console: *press @ and . Usual console login to the running zone: zlogin zone100

Runtime

Stop unneeded services

# svcadm disable inetd
# svcadm disable smtp
# svcadm disable autofs
# svcadm disable cron
# /etc/init.d/init.sma stop
# /etc/init.d/init.dmi stop
# /etc/init.d/init.snmpdx stop
# /etc/init.d/init.wbem stop
# pkill -u 0 -x dtlogin
# pkill -x stfontserverd
# svcadm disable name-service-cache

Obtaining and Setting Non-Global Zone Information from the Global Zone

# ps -efo user,zone,pid,ppid,c,stime,tty,time,comm |grep zone100
  root zone100 18386     1  0 12:45:24 ?      00:00 /usr/sbin/syslogd
  root zone100 18527     1  0 12:47:04 ?      00:00 /usr/lib/ssh/sshd
  ...

Removing zone

# zoneadm -z <zonename> uninstall
# zonecfg -z <zonename> delete

Helpful zone commands

Listing all zones:
$ zoneadm list -vc

Booting a zone:
# zoneadm -z <zonename> boot

Logging into a zone as the console:
# zlogin -C <zonename>
[escape via ~. ;
 remember to ~~ if you are connecting via SSH!]

Logging into a zone
[must be run as root; will connect as root of the zone]:
# zlogin <zonename>
[exit the zone by closing the shell]

Log into a zone as a specific user:
# zlogin -l <username> <zonename>

Shutting down a zone:
# zlogin
# shutdown -i5 -y -g0 [typical solaris shutdown command]

Rebooting a zone
[forcible reboot; bypasses shutdown scripts]:
# zoneadm -z <zonename> reboot

Removing a zone:
# zoneadm -z <zone-to-zap> uninstall
# zonecfg -z <zone-to-zap> delete

Powered by JunebugWiki v0.0.31 Page last edited by stoyan on December 18, 2006 05:20 PM (diff)
[readonly] Version 2 (current) «olderversions