A place for Unix Thoughts and Ideas

Determining Solaris Global zone name inside a local zone

As the number of Global zones has grown over the years, it is become extremely useful for myself and the DBAs to know which server their zone is hosted on.

This information is not easily displayed, but using a trick with the arp cache and IPMP, it can be easily obtained.

Now, there are two requirements

  1. 1. Your zones are using shared-ip network interfaces and not exclusive-IP.
  2. 2. Your IPMP test addresses are resolvable inside the zone and they are of the form servername-nic[01], if you use a different naming standard, they script could be updated for that.

For my setups, I set the IPMP tests addresses up as servername-nic0 and servername-nic1. This allows my build scripts to automatically setup IPMP during the Jumpstart process.

Here is my finished script for displaying the globalzone.


It will output:
root@testzone # ./global_zone.sh
The Global zone is testserver.testdomain.com


root@testserver # ./global_zone.sh
This is the global zone testserver.testdomain.com

The guts of the script are pretty simple, the greatest challenge was getting the regex just right for it work across all systems in the datacenter.

printf “The Global zone is `arp -a | egrep ‘nic.[\. ]..*SP’ | awk ‘{print $2}’ | perl -pe ‘s,-nic.*$,,’ | uniq`${DOMAIN}\n”


One response to “Determining Solaris Global zone name inside a local zone

  1. Pingback: Determining global zone name from inside a solaris 11 zone « rageek

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: