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

Saturday, 27 December 2014

Solaris Zones-4 [Zone with Exclusive IP]


ZONES-4 [CREATION]
                                        EXCLUSIVE IP

Fine… King has accommodated 2 out of 4 tenants

Now it’s time for tzone3

The Info provided by Tzone3 is,

House No                   IP   192.168.234.202
Separate gas pipeline      YES  I want my own (e1000g1)
Fancy item                 YES  CDROM
Guest                      NO   I don’t want shared FS from GZ
Other info                 NO   No info plz


SO… let’s prepare the accommodation for tzone3



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

root@sol-test-2:>/# ifconfig e1000g1 plumb

root@sol-test-2:>/# zonecfg -z tzone3
tzone3: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:tzone3> create
zonecfg:tzone3> set zonepath=/export/zones/tzone3
zonecfg:tzone3> set ip-type=exclusive
zonecfg:tzone3> add net
zonecfg:tzone3:net> set physical=e1000g1
zonecfg:tzone3:net> end
zonecfg:tzone3> set autoboot=true
zonecfg:tzone3> add device
zonecfg:tzone3:device> set match=/dev/rmt/0
zonecfg:tzone3:device> end
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
zonecfg:tzone3> verify
zonecfg:tzone3> commit
zonecfg:tzone3> exit

root@sol-test-2:>/# zoneadm -z tzone3 install

root@sol-test-2:>/# zoneadm -z tzone3 boot
zoneadm: zone 'tzone3': WARNING: skipping network interface 'e1000g1' which is used in the global zone.: Not owner
root@sol-test-2:>/# zlogin -C tzone3

Well… here it did not asked anything related to network

No IP / No Interface / No NFS …etc…

bash-3.2# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000

bash-3.2# dladm show-dev
dladm: insufficient privileges

bash-3.2# cat /etc/hosts
#
# Internet host table
#
::1     localhost       loghost tzone3
127.0.0.1       localhost       loghost tzone3


bash-3.2# vi /etc/hosts
#
# Internet host table
#
::1     localhost
127.0.0.1       localhost
192.168.234.202 tzone3 loghost


OKKKKkkkkkkk……   what was the problem ?

=======================================================================

1.  We do not need to plumb that in Global zone
2.  We do not need to set ip via ifconfig in global zone
3.  We need to go to the root path of our NGZ tzone3 i.e.
/export/zones/tzone3/root/etc
4.  Here we suppose to create
vi hostname.e1000g1 with Ip addr inside
5.  Then we need to alter hosts like
::1     localhost
127.0.0.1       localhost
192.168.234.150 tzone3 loghost
6.  Then try to reboot

======================================================================

I think we should do this again with fresh starting, Let me delete this zone and begin a new one


root@sol-test-1:>/#zoneadm -z tzone3 halt

root@sol-test-1:>/#zoneadm -z tzone3 uninstall
Are you sure you want to uninstall zone tzone3 (y/[n])? Y

root@sol-test-1:>/#zonecfg -z tzone3 delete -F


NOW…. Start,

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

root@sol-test-1:>/#ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
e1000g0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.234.133 netmask ffffff00 broadcast 192.168.234.255
        ether 0:c:29:c2:8f:90

NO NGZ & NO other interface,


root@sol-test-1:>/#mkdir /export/zones/tzone3
root@sol-test-1:>/#chmod 700 /export/zones/tzone3
root@sol-test-1:>/#zonecfg -z tzone3
tzone3: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:tzone3> create
zonecfg:tzone3> set zonepath=/export/zones/tzone3
zonecfg:tzone3> set ip-type=exclusive
zonecfg:tzone3> add net
zonecfg:tzone3:net> set physical=e1000g1
zonecfg:tzone3:net> end
zonecfg:tzone3> set autoboot=true
zonecfg:tzone3> add device
zonecfg:tzone3:device> set match=/dev/rmt/0
zonecfg:tzone3:device> end
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
zonecfg:tzone3> verify
zonecfg:tzone3> commit
zonecfg:tzone3> exit
root@sol-test-1:>/#zoneadm -z tzone3 install
Preparing to install zone <tzone3>.
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 <tzone3> is initialized.
The file </export/zones/tzone3/root/var/sadm/system/logs/install_log> contains a log of the zone installation.

root@sol-test-1:>cd /export/zones/tzone3/root/etc


root@sol-test-1:>/export/zones/tzone3/root/etc#vi hostname.e1000g1
"hostname.e1000g1" [New file]
192.168.234.202

wq!


root@sol-test-1:>/export/zones/tzone3/root/etc#vi hosts
"hosts" [Read only] 5 lines, 61 characters
#
# Internet host table
#
::1             localhost
127.0.0.1       localhost
192.168.234.202 tzone3  loghost      รง

wq!

root@sol-test-1:>/#zoneadm -z tzone3 boot

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

===========Answer all the questions================

tzone3 console login: root
Password:

bash-3.2# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
e1000g1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.234.202 netmask ffffff00 broadcast 192.168.234.255
        ether 0:c:29:c2:8f:9a

woohooo…. Got it this time,

Now lets check, its working or not?

Lets ping the global host….

bash-3.2# ping -s 192.168.234.133
PING 192.168.234.133: 56 data bytes
64 bytes from 192.168.234.133: icmp_seq=0. time=2.52 ms
64 bytes from 192.168.234.133: icmp_seq=1. time=1.01 ms
64 bytes from 192.168.234.133: icmp_seq=2. time=0.958 ms

bash-3.2# ping -s sol-test1
ping: unknown host sol-test1

bash-3.2# vi /etc/hosts
#
# Internet host table
#
::1     localhost
127.0.0.1       localhost
192.168.234.202 tzone3  loghost
192.168.234.133 sol-test1

wq!

bash-3.2# ping -s sol-test1
PING sol-test1: 56 data bytes
64 bytes from sol-test1 (192.168.234.133): icmp_seq=0. time=1.01 ms
64 bytes from sol-test1 (192.168.234.133): icmp_seq=1. time=0.941 ms
64 bytes from sol-test1 (192.168.234.133): icmp_seq=2. time=0.995 ms

OK…back from global zone,

root@sol-test-1:>/#ping -s tzone3
PING tzone3: 56 data bytes
64 bytes from tzone3 (192.168.234.202): icmp_seq=0. time=0.503 ms
64 bytes from tzone3 (192.168.234.202): icmp_seq=1. time=0.768 ms
64 bytes from tzone3 (192.168.234.202): icmp_seq=2. time=1.51 ms




No comments:

Post a Comment