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

Wednesday, 15 October 2014

Zones-3 [Configuring a Non Global Zone - B]


ZONES-3 [CONFIGURE NGZ-B]

Well… we had created a very simple NGZ tzone1

Now in our next NGZ tzone2… we will add some more

The Info provided by Tzone2 is,

House No                   IP   192.168.234.201
Separate gas pipeline      NO   will share the interface
Fancy item                 YES  TAPE DRIVE / CDROM
Guest                      NO   Don’t want shared FS from GZ
Other info                 YES  Yes I want attributes to be added

OK… from last config we have 2 more thing now i.e.

Device and attributes


Let’s configure…

root@sol-test-2:>/# mkdir /export/zones/tzone2

root@sol-test-2:>/# chmod 700 /export/zones/tzone2

root@sol-test-2:>/# zonecfg -z tzone2
tzone2: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:tzone2> create
zonecfg:tzone2> set zonepath=/export/zones/tzone2

zonecfg:tzone2> add net
zonecfg:tzone2:net> set address=192.168.234.201
zonecfg:tzone2:net> set physical=e1000g0
zonecfg:tzone2:net> end

zonecfg:tzone2> set autoboot=true

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

zonecfg:tzone2> add fs
zonecfg:tzone2:fs> set dir=/cdrom
zonecfg:tzone2:fs> set special=/cdrom
zonecfg:tzone2:fs> set type=lofs
zonecfg:tzone2:fs> end

zonecfg:tzone2> add attr
zonecfg:tzone2:attr> set name=root
zonecfg:tzone2:attr> set type=string
zonecfg:tzone2:attr> set value="anurag"
zonecfg:tzone2:attr> end

zonecfg:tzone2> add attr
zonecfg:tzone2:attr> set name=department
zonecfg:tzone2:attr> set type=string
zonecfg:tzone2:attr> set value="sys admin-xxxx"
zonecfg:tzone2:attr> end

zonecfg:tzone2> add attr
zonecfg:tzone2:attr> set name=phone
zonecfg:tzone2:attr> set type=string
zonecfg:tzone2:attr> set value=022-111-12345
zonecfg:tzone2:attr> end

zonecfg:tzone2> verify
zonecfg:tzone2> commit
zonecfg:tzone2> exit


OK…

Config is done

root@sol-test-2:>/# zoneadm list -cv
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global           running    /                              native   shared
   6 tzone1           running    /export/zones/tzone1           native   shared
   - tzone2           configured /export/zones/tzone2           native   shared

Well… what is extra here from last NGZ tzone1?

Device and attributes… right?

As we know that the resource “device” is used like facility to provide access for NGZ to the devices attached to GZ
Here we had given access for “device” tape drive
Actually cdrom is device but it falls under file system.
 **we cannot check the status of tape drive, its physically not              available**

And the other resource is “attr”
Means some kind of info, I had added three “attr”
1st is name, 2nd is department and 3rd one is phone

Ok… Now install the zone,

root@sol-test-2:>/# zoneadm -z tzone2 install
Preparing to install zone <tzone2>.
============o/p removed================
The file </export/zones/tzone2/root/var/sadm/system/logs/install_log> contains a log of the zone installation.

root@sol-test-2:>/# zoneadm -z tzone2 boot

root@sol-test-2:>/# zlogin -C tzone2

**answered all questions and

tzone2 console login: root
Password:

# bash
bash-3.2# hostname
tzone2

We left ourselves here in previous session,

Let’s some jogging now…

bash-3.2# ifconfig -a
lo0:2: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
e1000g0:2: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.234.201 netmask ffffff00 broadcast 192.168.234.255

[ see it's a virtual interface] 

bash-3.2# df -kh
Filesystem             size   used  avail capacity  Mounted on
/                      9.9G   245M   9.5G     3%    /
/cdrom                 7.2G   4.9G   2.3G    69%    /cdrom
/dev                   9.9G   245M   9.5G     3%    /dev
/lib                   7.2G   4.9G   2.3G    69%    /lib
/platform              7.2G   4.9G   2.3G    69%    /platform
/sbin                  7.2G   4.9G   2.3G    69%    /sbin
/usr                   7.2G   4.9G   2.3G    69%    /usr
proc                     0K     0K     0K     0%    /proc
ctfs                     0K     0K     0K     0%    /system/contract
mnttab                   0K     0K     0K     0%    /etc/mnttab
objfs                    0K     0K     0K     0%    /system/object
swap                   1.7G   340K   1.7G     1%    /etc/svc/volatile
/usr/lib/libc/libc_hwcap1.so.1
                       7.2G   4.9G   2.3G    69%    /lib/libc.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                   1.7G    36K   1.7G     1%    /tmp
swap                   1.7G    20K   1.7G     1%    /var/run

bash-3.2# prtconf -v |grep -i mem
prtconf: devinfo facility not available
Memory size: 2048 Megabytes

bash-3.2# swap -s
total: 589516k bytes allocated + 131264k reserved = 720780k used, 1744068k available
bash-3.2# bc
720780*512/1024/1024
351
1744068*512/1024/1024
851
851+351
1202

AT GZ

root@sol-test-2:>/# swap -s
total: 557204k bytes allocated + 130572k reserved = 687776k used, 1777152k available
root@sol-test-2:>/# bc
687776*512/1024/1024
335
1777152*512/1024/1024
867
867+335
1202


So ... MEMORY and SWAP are same as GZ, FS will also same if we made that on / (root), we had created our zones on separate slice that’s why it is showing the size of that slice.

OK… Let’s check the size of our NG Zones

root@sol-test-2:>/# df -kh |grep /export/zones
/dev/dsk/c1t3d0s0      9.9G   245M   9.5G     3%    /export/zones

Actually this is the situation of size, total 245M used and see what zones are thinking about themselves?

root@sol-test-2:>/# cd /export/zones/
root@sol-test-2:>/export/zones# ls -l
total 20
drwx------   2 root     root        8192 Oct 13 15:17 lost+found
drwx------   4 root     root         512 Oct 13 18:31 tzone1
drwx------   4 root     root         512 Oct 13 22:42 tzone2
root@sol-test-2:>/export/zones# du -sh tzone1
 5.2G   tzone1
root@sol-test-2:>/export/zones# du -sh tzone2
 7.2G   tzone2

Have u seen? What they are accommodating?

Actually 100-120MB … but pretending that they have 5.2G & 7.2G

OK… Fine… Now move ahead

I want to telnet tzone2 from GZ

root@sol-test-2:>/# telnet 192.168.234.201
Trying 192.168.234.201...
Connected to 192.168.234.201.
Escape character is '^]'.
login: root
Password:
Not on system console
Connection to 192.168.234.200 closed by foreign host.

Why so?

root@tzone2:>/#vi /etc/default/login

#CONSOLE=/dev/console      [#out this line]

wq!

root@sol-test-2:>/# telnet 192.168.234.201
Trying 192.168.234.201...
Connected to 192.168.234.201.
Escape character is '^]'.
login: root
Password:
Last login: Mon Oct 13 22:51:52 on console
Oracle Corporation      SunOS 5.10      Generic Patch   January 2005
root@tzone2:>/#

Let’s check the cdrom

root@tzone2:>/#cd /cdrom/
root@tzone2:>/cdrom#cd sol_10_811_x86/
root@tzone2:>/cdrom/sol_10_811_x86#ls -l
total 28
-r--r--r--   1 root     root        7225 Jun  2  2011 Copyright
-r--r--r--   1 root     root        1747 Jun  1  2011 Offer_to_Provide_Source_Code.txt
dr-xr-xr-x   7 root     root        2048 Aug 24  2011 Solaris_10
dr-xr-xr-x   5 root     root        2048 Aug 24  2011 boot
-r-xr-xr-x   1 root     root         257 Aug 24  2011 installer


Well… it is working in our tzone2



No comments:

Post a Comment