Hi, For the project I am working on I need to find out the network IP address that is assigned to the domU which has been assigned via DHCP. I could run a command like ''pntadm'' on the DHCP server and get the IP address based on the MAC address of the domU. My concern here is that I may not have control over the DHCP server on that subnet. So the two alternate approach are: 1)Access the domU via virsh console, run ifconfig to grep the IP address of the primary interface. However I need to do this via a script so would have to be able to run virsh console <domain name> | <command> and the return this information back on to dom0. Is this possible to do or is there an easier way? 2) The other alternate was to run a ARP or RARP to get the MAC address to IP mapping. If anyone has a better solution or suggestion the please let me know. Thanks, Sagun
check out the xenstore utilities. It appears that at least some domain IPs are stored in xenstore /usr/lib/xen/bin/xenstore-ls | grep 192 0 = "192.y.x.229" 0 = "192.y.x.176" I don''t think its recording all the IPs though, we have two interfaces in each domain, xenstore contains only the front end interface. You might be able to write into the xenstore from the guest, if you can, you could write a DHCP client hook that write the IP address into the xenstore after it is aquired. If you are hosting heterogeneous guests, this could be time consuming to write various scripts for various hosts, and then, if you don''t control root, someone could disable them. I just talked myself out of that answer. using ARP/RARP might be the easiest way, for you to do it in a guest-neutral way. --joe sagun shakya wrote:> Hi, > > For the project I am working on I need to find out the network IP > address that is assigned to the domU which has been assigned via DHCP. > I could run a command like ''pntadm'' on the DHCP server and get the IP > address based on the MAC address of the domU. My concern here is that > I may not have control > over the DHCP server on that subnet. So the two alternate approach are: > 1)Access the domU via virsh console, run /ifconfig/ to grep the IP > address of the primary interface. However I need to do this via a > script so would have to be able to run > virsh console <domain name> | <command> and the return this > information back on to dom0. Is this possible to do or is there an > easier way? > > 2) The other alternate was to run a ARP or RARP to get the MAC address > to IP mapping. > > If anyone has a better solution or suggestion the please let me know. > > > Thanks, > > Sagun > > ------------------------------------------------------------------------ > > _______________________________________________ > xen-discuss mailing list > xen-discuss@opensolaris.org >
On Tue, Oct 13, 2009 at 04:08:14PM -0700, Joseph Mocker wrote:> check out the xenstore utilities. It appears that at least some domain > IPs are stored in xenstore > > /usr/lib/xen/bin/xenstore-ls | grep 192 > 0 = "192.y.x.229" > 0 = "192.y.x.176" > > I don''t think its recording all the IPs though, we have two interfaces > in each domain, xenstore contains only the front end interface.The "ipagent" service runs in a Solaris domU, and writes the IP address of the primary interface to xenstore. So that''s where it comes from.> using ARP/RARP might be the easiest way, for you to do it in a > guest-neutral way.Yep. In fact I''d be interested in integrating something like that in the tool stack, so we can report this uniformly. Some arping versions can supposedly "ping" a target MAC, but only by breaking the spec, as far as I can see. And some OS types like Win XP won''t respond. I''m far from a networking guy, but I don''t think ARP can help here. You could broadcast ICMP to each of the VNICs, possibly, but again there''s no guarantee a guest would respond. Your other alternative would be to learn the MAC from snooping the guest''s VNIC, but that seems fraught with problems. regards john
Thank you John and Joe for your help. On Oct 13, 2009, at 5:51 PM, John Levon wrote:> On Tue, Oct 13, 2009 at 04:08:14PM -0700, Joseph Mocker wrote: > >> check out the xenstore utilities. It appears that at least some >> domain >> IPs are stored in xenstore >> >> /usr/lib/xen/bin/xenstore-ls | grep 192 >> 0 = "192.y.x.229" >> 0 = "192.y.x.176" >> >> I don''t think its recording all the IPs though, we have two >> interfaces >> in each domain, xenstore contains only the front end interface. > > The "ipagent" service runs in a Solaris domU, and writes the IP > address > of the primary interface to xenstore. So that''s where it comes from.For the use case for me to find the IP address, the primary interface is what is needed. Is the xenstore utility tool a stable tool or something that can be used in a reliable way? I searched around for more information but could not find for xenstore- ls.>> using ARP/RARP might be the easiest way, for you to do it in a >> guest-neutral way. > > Yep. In fact I''d be interested in integrating something like that in > the > tool stack, so we can report this uniformly. Some arping versions can > supposedly "ping" a target MAC, but only by breaking the spec, as > far as > I can see. And some OS types like Win XP won''t respond. I''m far from a > networking guy, but I don''t think ARP can help here. > > You could broadcast ICMP to each of the VNICs, possibly, but again > there''s no guarantee a guest would respond. >Yeah, I may have to take this route if the xenstore-ls is not a reliable approach. Thanks, Sagun
On Wed, Oct 14, 2009 at 09:05:08AM -0600, sagun shakya wrote:> >The "ipagent" service runs in a Solaris domU, and writes the IP > >address of the primary interface to xenstore. So that''s where it > >comes from. > > For the use case for me to find the IP address, the primary interface > is what is needed. Is the xenstore utility tool a stable tool or > something that can be used in a reliable way? I searched around for > more information but could not find for xenstore- ls.It''s reliable enough. Obviously you have to wait for the ipagent service to run before it appears. The actual way you retrieve this information may change in the future, though. regards john
John Levon wrote:> On Wed, Oct 14, 2009 at 09:05:08AM -0600, sagun shakya wrote: > > >>> The "ipagent" service runs in a Solaris domU, and writes the IP >>> address of the primary interface to xenstore. So that''s where it >>> comes from. >>> >> For the use case for me to find the IP address, the primary interface >> is what is needed. Is the xenstore utility tool a stable tool or >> something that can be used in a reliable way? I searched around for >> more information but could not find for xenstore- ls. >> > > It''s reliable enough. Obviously you have to wait for the ipagent service > to run before it appears. The actual way you retrieve this information > may change in the future, though. >If I read John right, it sounds like ipagent is a *Solaris thing, so as long as you''re only running *Solaris guests, you can use ipagent/xenstore. otherwise I think you might be looking for a more general approach. --joe
* mock@sun.com [2009-10-14 16:34:22]> John Levon wrote: > > On Wed, Oct 14, 2009 at 09:05:08AM -0600, sagun shakya wrote: > > The "ipagent" service runs in a Solaris domU, and writes the IP > address of the primary interface to xenstore. So that''s where it > comes from. > > For the use case for me to find the IP address, the primary interface > is what is needed. Is the xenstore utility tool a stable tool or > something that can be used in a reliable way? I searched around for > more information but could not find for xenstore- ls. > > It''s reliable enough. Obviously you have to wait for the ipagent service > to run before it appears. The actual way you retrieve this information > may change in the future, though. > > If I read John right, it sounds like ipagent is a *Solaris thing, so as long as you''re only > running *Solaris guests, you can use ipagent/xenstore. otherwise I think you might be looking > for a more general approach.Our Windows PV drivers also do this, as I recall. dme. -- David Edmondson, Sun Microsystems, http://dme.org