How to know the global zonename from non-global zone?

It is easy to list all zones from global zones, but how to find out the global zone name from non-global zone?

thx

Check the /etc/zones directory. there will be a xml file in here. you might find some clue in there.

The global zone name is always simply "global". There is no built in way to disclose information about any other zone including the global one to any non-global zone. This is by design. Of course, you can add /etc/hosts entries to the zones from the global one.

Yup correct jlliagre :o I forgot that its just global.. Was thinking something else. my mistake..:smiley:

Your interpretation is correct, I want to know about non-global zones parent information, Since its name is always global, how to get its ip?

The reason is that i can jump to its global zone to halt the non-global zone in case it freezes.

/etc/zones only have 1 index file in non-global zone. I doesn't has information about global zone.

thx

Why would you take this route? If the zone is frozen than you won't be able to access it. On the other have if you can examine /etc/zones, aren't you already in the global zone?

If you need the information within the zone, then just provision the hostname of the global zone in /etc/hosts in the NGZ as part of your zone creation routine.

The following scenenario may explain my need.

  1. I ssh login to a NGZ and I want to reboot it.
  2. Before issue init 6, I know it may freeze when rebooting.
  3. Without any documentation, I need to find out the IP of the GZ
  4. so I can ssh to GZ, ready to issue "zoneadm -z xx reboot" when NGZ freeze.

once again...

I will take your answer as "it is impossible to know GZ's IP from NGZ by default, unless it is properly documented somewhere".

That is what I expected, just to widen audience.

I have worked a not-so-decent solution, NG and NZG have the same MAC address, Based on the theory, You can filter out a list of ips which have same MAC address.

then ran remote ls command to check GZ's who has xml files in /etc/zones/

ssh IP1 'grep NGZIP /etc/zones/*.xml'

As I wrote earlier in post #3, this is by design. You are not supposed to get any information about any other zone from a NGZ.

This won't work in all configurations.
The various zones might use different network interfaces and so might have different MAC addresses.
Future network virtualization techniques (Crossbow project) will allow even zones sharing the same NIC to have different MAC addresses.