Wise people learn when they can; fools learn when they must - Arthur Wellesley

Sunday, 28 December 2014

ZONES-7 [RECAP]


ZONES-7 [RECAP]

Well… Let’s see, what we are capable to do with Zones till now

·         Define the zones & its features
·         Create a NGZ with minimal config
·         Create a NGZ with device shared from GZ
·         Create a NGZ with FS (lofs) shared from GZ
·         Create a NGZ with EXCLUSIVE IP settings
·         Rename a NGZ
·         Changing HOSTNAME/IP of NGZ
·         Create a NGZ with WHOLE ROOT CONFIG
·         Create a NGZ with UFS shared from GZ
·         Moving a zone within system
·         Moving a zone to other system
·         Cloning a zone
·         Delete a zone


I think till we learned only these, OOOHHhhhhhhhhh….

Still a long way to go……But before that just a quick recap of all…

OK…

Basically we have only 2 commands for zone,

Zonecfg for config related

Zoneadm for zone administration / manage

CONFIGURE A SPARSE ROOT ZONE,

root@sol-test-2:>/# mkdir /export/zones/tzone1
root@sol-test-2:>/# chmod 700 /export/zones/tzone1
root@sol-test-2:>/# zonecfg -z tzone1
zonecfg:tzone1> create
zonecfg:tzone1> set zonepath=/export/zones/tzone1
zonecfg:tzone1> set autoboot=true
zonecfg:tzone1> commit
zonecfg:tzone2> verify
zonecfg:tzone1> exit

CONFIGURE A WHOLE ROOT ZONE,

root@sol-test-1:>/#zonecfg -z tzone4
zonecfg:tzone4> remove inherit-pkg-dir dir=/usr
zonecfg:tzone4> remove inherit-pkg-dir dir=/sbin
zonecfg:tzone4> remove inherit-pkg-dir dir=/lib
zonecfg:tzone4> remove inherit-pkg-dir dir=/platform
zonecfg:tzone4> verify
zonecfg:tzone4> commit
zonecfg:tzone4> exit

INSTALL / BOOT / CONSOLE LOGIN TO ZONE

root@sol-test-2:>/# zoneadm -z tzone1 install
root@sol-test-2:>/# zoneadm -z tzone1 boot
root@sol-test-2:>/# zlogin -C tzone1

SHARED / EXCLUSIVE IP

(shared)

root@sol-test-2:>/# zonecfg -z tzone1
zonecfg:tzone1> add net
zonecfg:tzone1:net> set address=192.168.234.200
zonecfg:tzone1:net> set physical=e1000g0
zonecfg:tzone1:net> end

(exclusive)

zonecfg:tzone3> set ip-type=exclusive
zonecfg:tzone3> add net
zonecfg:tzone3:net> set physical=e1000g1
zonecfg:tzone3:net> end

DEVICE

zonecfg:tzone3> add device
zonecfg:tzone3:device> set match=/dev/rmt/0
zonecfg:tzone3:device> end

FS
(cdrom)
zonecfg:tzone3> add fs
zonecfg:tzone3:fs> set dir=/cdrom
zonecfg:tzone3:fs> set special=/cdrom
zonecfg:tzone3:fs> set type=lofs
zonecfg:tzone3:fs> end

(ufs)

Create and newfs the partion
root@sol-test-1:>/# mkdir /export/zones/tzone4/root/testdir4WRzone

root@sol-test-1:>/# mount -f ufs /dev/dsk/c1t2d0s0 /export/zones/tzone4/root/testdir4WRzone

root@sol-test-1:>/# zonecfg -z tzone4
zonecfg:tzone4> add fs
zonecfg:tzone4:fs> set dir=/testdir4WRzone
zonecfg:tzone4:fs> set special=/dev/dsk/c1t2d0s0
zonecfg:tzone4:fs> set raw=/dev/rdsk/c1t2d0s0
zonecfg:tzone4:fs> set type=ufs
zonecfg:tzone4:fs> add options [logging,nosuid]
zonecfg:tzone4:fs> end

REANAME NG ZONE

root@sol-test-1:>/# zonecfg -z tzone2
zonecfg:tzone2> set zonename=newzone
zonecfg:newzone> verify
zonecfg:newzone> commit
zonecfg:newzone> exit

MOVING ZONE ON SAME SYSTEM

root@sol-test-1:>/# zoneadm -z tzone2 halt
root@sol-test-1:>/# zoneadm -z tzone2 move /export/zones/newzone


MOVING ZONE ON OTHER SYSTEM

root@sol-test-1:>/# zoneadm -z tzone3 halt
root@sol-test-1:>/# zoneadm -z tzone3 detach
root@sol-test-1:>/# cd /export/zones/
root@sol-test-1:>/export/zones# tar -cvf tzone3.tar tzone3
root@sol-test-1:>/export/zones# scp tzone3.tar sol-tst-2:/zone@sol-test2/zones/

Commands on other system
root@sol-tst-2:>/# cd /zone@sol-test2
root@sol-tst-2:>/zone@sol-test2# chmod 700 zones
root@sol-tst-2:>/zone@sol-test2# cd zones/
root@sol-tst-2:>/zone@sol-test2/zones# tar -xf tzone3.tar
root@sol-tst-2:>/# zonecfg -z tzone3
root@sol-tst-2:>/# zoneadm -z tzone3 attach
[if error about FS / device / Nic….then remove them like….]
root@sol-tst-2:>/# zonecfg -z tzone3
zonecfg:tzone3> remove fs dir=/testdir
zonecfg:tzone3> commit
zonecfg:tzone3> exit

[if error about pkgs then]
root@sol-tst-2:>/# zoneadm -z tzone3 attach [ -U or –F]
root@sol-tst-2:>/# zoneadm -z tzone3 boot

CLONING OF ZONE

#zoneadm –z tzone3 halt
root@sol-test-1:>/# mkdir /export/zones/clonedZone
root@sol-test-1:>/# chmod 700 /export/zones/clonedZone
root@sol-test-1:>/# touch /export/zones/master
root@sol-test-1:>/# zonecfg -z tzone3 export -f /export/zones/master
root@sol-test-1:>/# vi /export/zones/master
[alter this file as per requirement]
root@sol-test-1:>/# zonecfg -z clonedZone -f /export/zones/master
root@sol-test-1:>/# zoneadm -z clonedZone install
root@sol-test-1:>/# zoneadm -z clonedZone boot
root@sol-test-1:>/# zlogin -C clonedZone


IP CHANGE OF SPARSE NGZ

root@sol-test-1:>/# zonecfg -z newzone
zonecfg:newzone> remove net
Are you sure you want to remove ALL 'net' resources (y/[n])? y
zonecfg:newzone> add net
zonecfg:newzone:net> set address=192.168.234.209
zonecfg:newzone:net> set physical=e1000g0
zonecfg:newzone:net> end
zonecfg:newzone> verify
zonecfg:newzone> commit
zonecfg:newzone> exit

root@sol-test-1:>/# zlogin -C newzone
# vi /etc/hosts
#
# Internet host table
#
::1     localhost
127.0.0.1       localhost
192.168.234.209 newzone loghost

# reboot

newzone console login: root
Password:
Last login: Wed Dec 24 04:56:07 on console
Dec 24 04:58:39 newzone login: ROOT LOGIN /dev/console
Oracle Corporation      SunOS 5.10      Generic Patch   January 2005
# ifconfig -a
lo0:1: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
e1000g0:1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.234.209 netmask ffffff00 broadcast 192.168.234.255


DELETE A ZONE

root@sol-test-1:>/# zoneadm -z newzone halt
root@sol-test-1:>/# zoneadm -z newzone uninstall –F
root@sol-test-1:>/# zonecfg -z newzone delete -F


No comments:

Post a Comment