Today on this ol' server

Wednesday Feb 06, 2008

Where am I?

Been far to long since I've blogged. Today on this ol' server is a very quick tip. Here's how to tell if you're logged in to a zone or global zone. Run ps with the zone flag. If you're in the global zone the zone will be labeled global. In this example the zone is labeled myzone:

myhost01% ps -efZ
    ZONE     UID   PID  PPID   C    STIME TTY         TIME CMD
myzone     root   701   624   0   Nov 26 ?           0:38 /lib/svc/bin/svc.startd
myzone     root 17728   624   0   Dec 05 ?           0:00 /usr/lib/ssh/sshd
Which leads me to: where is this zone hosted? I'm not sure how long this will exist in Solaris or if this is changed with crossbow, but as of OpenSolaris build 70b and Solaris 10, you can check the arp tables and look for the primary interface. In this example we see that 192.x.x.59 is plumbed to the same interface as 192.x.x.46 which was given to myzone.
myhost01% arp -an |grep SP
nge0   192.x.x.59         255.255.255.255 SPLA     00:14:4f:x:x:a
nge0   192.x.x.46         255.255.255.255 SPLA     00:14:4f:x:x:a
Now I know that if I want to manage the myzone from the console I can ssh to 192.x.x.59 and issue the command zlogin -C myzone *The SP options are backwards-compatible to older versions of arp to list the static entries.

Comments:

/usr/bin/zonename is usually easier (especially for scripting). It'll say global if you're in the global or the zonename otherwise.

ps -efZ will show all the zones processes from the global zone which can be useful at times (as can prstat -Z).

Posted by Paul on December 19, 2008 at 12:21 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed

Calendar

Feeds

Search

Links

Navigation

Referrers