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

Monday, 13 October 2014

Zones-2 [Configuring a simple Non Global Zone-A]


ZONES-2 [CONFIGURE NGZ-A]

Fine… we had completed our basics in previous post, now need to configure NGZ

So, the king has selected 4 tenants,

Tzone1     PG (bachelor)   Sparse root
Tzone2     PG (bachelor)   Sparse root
Tzone3     PG (bachelor)   Sparse root
wr-zone    With family     Whole root

The Info provided by Tzone1 is,

House No                   IP   192.168.234.200
Separate gas pipeline      NO   will share the interface
Fancy item                 NO   Don’t want extra devices
Guest                      NO   Don’t want shared FS from GZ
Other info                 NO   Don’t want any attributes to be added


After that tzone1 is allowed to stay,

Before his stay, King has prepared His lodging; let’s see how tzone1’s lodging has been prepared?

Created a slice of 10gb

Making FS
root@sol-test-2:>/# newfs /dev/rdsk/c1t3d0s0

Created a directory to mount
root@sol-test-2:>/# mkdir -p /export/zones

Mount the partition
root@sol-test-2:>/# mount -F ufs /dev/dsk/c1t3d0s0 /export/zones

Making entry in vfstab
root@sol-test-2:>/# vi /etc/vfstab
/dev/dsk/c1t3d0s0      /dev/rdsk/c1t3d0s0       /export/zones  ufs     1       yes     -

Well… I don’t have sufficient space that’s why I had created slice, IF u have enough space then just create a directory ( /export/zones) and continue,

SO… after doing these works King got frustrated that OMG this is not an easy job, at least for me. I must need to appoint someone who will do all these and also I need to appoint one more person who will control the activities of tenants,

So, King has appointed 2 officers,
1 to create, delete, add, edit …etc… for config related works
2nd for controlling & administer their activities

1st officer responsible for config designated as “zonecfg”
2nd officer responsible for controlling & administer, designated as          “zoneadm”

Now KING was feeling very relax, and ordered zonecfg to prepare accommodation for tzone1,

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


root@sol-test-2:>/# chmod 700 /export/zones/tzone1
# 700 so that nobody has access except GZ/root


#zonecfg –z <name of zone>

root@sol-test-2:>/# zonecfg -z tzone1
tzone1: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:tzone1> create
zonecfg:tzone1> set zonepath=/export/zones/tzone1
zonecfg:tzone1> add net
zonecfg:tzone1:net> set address=192.168.234.200
zonecfg:tzone1:net> set physical=e1000g0
zonecfg:tzone1:net> end
zonecfg:tzone1> set autoboot=true
zonecfg:tzone1> commit
zonecfg:tzone2> verify
zonecfg:tzone1> exit

create / add / set / select / info / revert / end / commit
are subcommands for zonecfg

net / zonepath / fs / inherit-pkg-dir / device / rctl / attr
are resource types of zonecfg

we will discuss them all one by one in several examples.

Ok… let’s intersect what “zonecfg” has done…

We started with #zonecfg -z tzone1

Means configure a zone (-z) with zonename tzone1

>create              [create a zone for me]
>set zonepath        [this path will be root path for zone]
>add net             [now I am going in network settings]
>set address         [ip address]
>set physical        [interface]
>end                 [network configuration is over]
>set autoboot=true   [let the system boot automatically when it is                              rebooted]
>commit              [make these config permanent]
>verify              [to chk the config, if nothing in o/p means ok]
>exit                [done with zonecfg]



OK… now the “zoneadm” declared I had configured NGZ tzone1 and my job is over, let the admin “zoneadm” do his job

Now zoneadm will need to install the would be zone tzone1, before that lets check the state

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

root@sol-test-2:>/# zoneadm -z tzone1 install
Preparing to install zone <tzone1>.
Creating list of files to copy from the global zone.
Copying <2923> files to the zone.
Initializing zone product registry.
Determining zone package initialization order.
Preparing to initialize <1466> packages on the zone.
Initialized <1466> packages on zone.
Zone <tzone1> is initialized.
The file </export/zones/tzone1/root/var/sadm/system/logs/install_log> contains a log of the zone installation.

While the installation status of zone was

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

After installation status of zone is

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

Now the zoneadm needs to boot the tzone1,

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

after booting let’s check the status of tzone1

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

Before moving ahead, I want to shut this zone, Mind it—not zoneadm but I want to shut this off to check something,

root@sol-test-2:>/# zoneadm -z tzone1 halt

well… zone is halted so just check the status,

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

Well to get this status you must have to very fast, here u fire the halt and there the status will change twice, one what we got “shutting_down” is within the process of halting, after completion of command we get this…

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

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

ok … again I booted the zone,

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

Have u noticed one thing?

Whenever zone goes to installed state, it has no zone id.

SO what happen, leave the happenings… first see the zone states

When zonecfg has created the zone it was in “configured” state

When we installed the zone it was in “incomplete” while installation

When we installed zone, the state changed to “installed

When we boot the zone, it directly goes to “running” state

Before going to running state, zone travelled the “ready” state in which it,
  • Mounts the FS 
  • plumb the interface
  • get the zone id
  • associate a zshed process


When we halt the zone it first goes to “shutting down” if zone successfullyshut, then again the state will be “installed”

So how many states zone travelled?

1.  Configured
2.  Incomplete
3.  Installed
4.  Ready
5.  Running
6.  Shutting down

Conf-inc-ins-read-run-shut [ I remembered them in this way]

Well… let’s back to our zone…

Currently it is running

We need to login in to zone and configure, Let’s do it…

OK… but before moving, I want to take notice one more thing,

Again I halted the zone,

root@sol-test-2:>/# zoneadm -z tzone1 halt

root@sol-test-2:>/# ps -elf |grep -i z
 F S      UID   PID  PPID   C PRI NI     ADDR     SZ    WCHAN    STIME TTY         TIME CMD
 0 O     root  7639  1163   0  50 20        ?    356          19:02:42 pts/3       0:00 grep -i z

Nothing in o/p?

Ok… let’s boot the zone,

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

root@sol-test-2:>/# ps -elf |grep -i z
F S      UID   PID  PPID   C PRI NI     ADDR     SZ    WCHAN    STIME TTY         TIME CMD
 0 S     root  7854  1163   0  50 20        ?    360        ? 19:05:36 pts/3       0:00 grep -i z
 1 S     root  7643     1   0   0 SY        ?      0        ? 19:02:49 ?           0:00 zsched

Have u noticed something?

A new process has been started named “zshed” … just keep this in mind, we will discuss about it while learning daemons

Now time to login into zone…

root@sol-test-2:>/# zlogin -C tzone1
[Connected to zone 'tzone1' console]

**We need to answer the some questions as we do at the time of OS installation


Select a Language

  0. English

Please make a choice (0 - 4), or press h or ? for help: 0

Select a Locale

   0. English (C - 7-bit ASCII)
  
  15. Go Back to Previous Screen

Please make a choice (0 - 15), or press h or ? for help: 0

What type of terminal are you using?

 1) ANSI Standard CRT
 2) DEC VT52
 3) DEC VT100

 14) Other
Type the number of your choice and press Return: 3

Creating new rsa public/private host key pair
Creating new dsa public/private host key pair
Configuring network interface addresses: e1000g0.

─ Host Name for e1000g0:1 ──────────────────────────────────────────────────────

             Host name for e1000g0:1 tzone1

───────────────────────────────────────────────────────────
    F2_Continue    F6_Help



Confirm the following information.  If it is correct, press F2;
    to change any information, press F4.

                          Host name: tzone1

    Esc-2_Continue  



      Configure Kerberos Security
      ───────────────────────────
      [ ] Yes
      [X] No

──────────────────────────────────────────────────────────────────────────
      Esc-2_Continue    Esc-6_Help



> Confirm the following information.  If it is correct, press F2;
    to change any information, press F4.


        Configure Kerberos Security: No

──────────────────────────────────────────────────────────────────────────
    Esc-2_Continue   



─ Name Service ─────────────────────────────────────────────────────────────────

  > To make a selection, use the arrow keys to highlight the option
    and press Return to mark it [X].


      Name service
      ────────────
      [ ] NIS+
      [ ] NIS
      [ ] DNS
      [ ] LDAP
      [X] None

──────────────────────────────────────────────────────────────────────────
    Esc-2_Continue    Esc-6_Help



> Confirm the following information.  If it is correct, press F2;
    to change any information, press F4.


                       Name service: None

──────────────────────────────────────────────────────────────────────────
    Esc-2_Continue    Esc-4_Change    Esc-6_Help



The current NFSv4 default domain is: ""


      NFSv4 Domain Configuration
      ──────────────────────────────────────────────
      [X] Use the NFSv4 domain derived by the system
      [ ] Specify a different NFSv4 domain

──────────────────────────────────────────────────────────────────────────
    Esc-2_Continue    Esc-4_Change    Esc-6_Help



> Confirm the following information.  If it is correct, press F2;
    to change any information, press F4.


                 NFSv4 Domain Name:  << Value to be derived dynamically >>

──────────────────────────────────────────────────────────────────────────
    Esc-2_Continue    Esc-4_Change    Esc-6_Help



Continents and Oceans
      ──────────────────────────────────
  -   [ ] Africa
  │   [ ] Americas
  │   [ ] Antarctica
  │   [ ] Arctic Ocean
  │   [X] Asia
  v   [ ] Indian Ocean

──────────────────────────────────────────────────────────────────────────
    Esc-2_Continue    Esc-6_Help



Countries and Regions
      ────────────────────────
  ^   [ ] Georgia
  │   [ ] Hong Kong
  │   [X] India

 Esc-2_Continue


> Confirm the following information.  If it is correct, press F2;
    to change any information, press F4.


                          Time zone: Asia/Calcutta

Esc-2_Continue

> If you do not want a root password, leave both entries blank.


                     Root password:  ****
                     Root password:  ****

──────────────────────────────────────────────────────────────────────────
    Esc-2_Continue    Esc-6_Help


rebooting system due to change(s) in /etc/default/init

SunOS Release 5.10 Version Generic_147441-01 64-bit
Copyright (c) 1983, 2011, Oracle and/or its affiliates. All rights reserved.
Hostname: tzone1

tzone1 console login:root
Password:

Oct 13 19:16:55 tzone1 login: ROOT LOGIN /dev/console
Oracle Corporation      SunOS 5.10      Generic Patch   January 2005
#



***have u seen it’s same as we usually get at the time of OS installation***


OK now we got out tzone1 live…
#bash

bash-3.2# hostname
tzone1

bash-3.2# ping 192.168.234.134
192.168.234.134 is alive
bash-3.2# ping 192.168.234.133
192.168.234.133 is alive

bash-3.2# telnet 192.168.234.133
Trying 192.168.234.133...
Connected to 192.168.234.133.
Escape character is '^]'.
login: root
Password:
Last login: Mon Oct  6 19:56:00 from 192.168.234.1
Oracle Corporation      SunOS 5.10      Generic Patch   January 2005
root@sol-test-1:>/#exit
logout
Connection to 192.168.234.133 closed by foreign host.


OK… so it is Fully functional …

 Now logout from zone..

bash-3.2# exit
# exit
tzone1 console login: ~.        [ ~. to exit from this prompt]
[Connection to zone 'tzone1' console closed]
root@sol-test-2:>/#

Great….

Now in next session we will create tzone2 with some more parameters



No comments:

Post a Comment