Assumpations:Here i am having local zone “sol1” is running on Global-zone
Global-zone# zoneadm list -cv ID NAME STATUS PATH BRAND IP 0 global running / native shared 8 sol1 running /export/zone/sollz1 native shared
Login to local zone and execute the below command:If you are getting many IP’s, then that global zone may have more local zones.You can suppress those IP’s by confirming global or local zone by using zonename command.(Login to those IP address and type “zonename” to determined that.)
Local-zone# arp -a|grep SP e1000g0 192.168.56.130 255.255.255.255 SPLA 00:0c:29:5e:76:f5 bash-3.00# exit # ^D
Login to IP 192.168.56.130 and type zonename.If the output global,then this is the global zone where that local zone is running.
Global-zone#zonename global Global-zone# ifconfig -a lo0: flags=2001000849 mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 lo0:1: flags=2001000849 mtu 8232 index 1 zone sol1 inet 127.0.0.1 netmask ff000000 e1000g0: flags=1004843 mtu 1500 index 2 inet 192.168.56.130 netmask ffffff00 broadcast 192.168.56.255 ether 0:c:29:5e:76:f5
How to see the global zone name in local zone permanently ?
There is a workaround to see global zone name in local zone permanently by adding one small script in global’s crontab.
Add the below entries in root crontab of global zone.This will write the global zone name in all the local zones every hour.you can check it in /etc/GLOBALZ file in all the local zones.
# To write the global zone name on all local zone hourly 00 * * * * /root/globalzonename.sh >/dev/null 2>&1
Keep the “globalzonename.s”h in /root and make is executable.
Global-Zone# cat globalzonename.sh #!/usr/bin/bash for i in `/usr/sbin/zoneadm list -v | /usr/bin/egrep -v "ID|global" |/usr/bin/awk ' { print $4 } '`; do echo `uname -n` > $i/root/etc/GLOBALZ; done
Verifying our work after an hour,
Local-zone# cat /etc/GLOBALZ sfos
If you want to find the zone type, you can just type “zonename” command.If its a global zone ,you will get output as “global” otherwise you will get hostname.
How to identify the zone type ? whole root zone or sparse root zone ?
Use “pkgcond -n is_what” command to determine the zone type. This command output shows the below values. (1= True 0=False )
For local zone + whole root zone
is_global_zone=0
is_nonglobal_zone=1
is_sparse_root_nonglobal_zone=0
is_whole_root_nonglobal_zone=1
For local zone + Sparse root zone
is_global_zone=0
is_nonglobal_zone=1
is_sparse_root_nonglobal_zone=1
is_whole_root_nonglobal_zone=0
For Global zone
is_global_zone=1
is_nonglobal_zone=0
is_sparse_root_nonglobal_zone=0
is_whole_root_nonglobal_zone=0
Refer the here for more information about pkgcond use.
Thank you for reading this article.Please leave a comment if you have any doubt.I will get back to you.