Add new comment

Solaris Zones & finding machine name

If you use Solaris Zones sometimes it is nice to be able to know the name of the global/parent machine the zone is running on.

Using 'arp -a' you can get information about network interfaces shared by the hosts on 1 machine.

I'm not going to give a whole full blown script to do this as our naming standards are probably different than yours but you can see the steps you may need to follow below to get the info:

Here is how to see all the network interfaces for you current host:

HOSTNAME=`hostname`
/u01/app/oracle >arp -a | grep $HOSTNAME
ce0 amr-dbzone04c.mycompany.com 255.255.255.255 SPLA aa:01:bb:02:cc:03

The important part here is the mac address, you can extract it like this:

HOSTNAME=`hostname`
MYMAC=`arp -a | grep $HOSTNAME | awk '{print $NF}'`
echo $MYMAC
aa:01:bb:02:cc:03

Now check arp again for other hosts that share this mac address:

/u01/app/oracle/david >arp -a | grep $MYMAC
ce0 amr-dbserv04.mycompany.com 255.255.255.255 SPLA aa:01:bb:02:cc:03
ce0 amr-dbzone04a.mycompany.com 255.255.255.255 SPLA aa:01:bb:02:cc:03
ce0 amr-dbzone04b.mycompany.com 255.255.255.255 SPLA aa:01:bb:02:cc:03
ce0 amr-dbzone04c.mycompany.com 255.255.255.255 SPLA aa:01:bb:02:cc:03
ce0 amr-dbzone04d.mycompany.com 255.255.255.255 SPLA aa:01:bb:02:cc:03
ce0 amr-dbzone04e.mycompany.com 255.255.255.255 SPLA aa:01:bb:02:cc:03

In my environment I can use our naming standard to pick out the parent server (you may have to find a different way to do this depending on your environment):

/u01/app/oracle/david >arp -a | grep $MYMAC | grep dbserv
ce0 amr-dbserv04.mycompany.com 255.255.255.255 SPLA aa:01:bb:02:cc:03

/u01/app/oracle/david >arp -a | grep $MYMAC | grep dbserv | awk '{print $2}'
amr-dbserv04.mycompany.com

References:

ARP and the ARP table

Solaris Zones Partitioning Technology

Thanks to Lawrence Z. and Jackie A. for turning me on to this information.