Classic question. The DomUs are like machines in the network and it is not easy to find the IP of the domU machines. Most of the times, the DomUs are connected to physical ethernet of Dom0 via bridge. So arp on the bridge must show the ip addresses in that machine. I usually do a ping -b 255.255.255.255 which will make all the machines to reply. Once this is done, within a short period if we try to do a arp information arp -n you will get a list of ip addresses. The only problem is to sort out which IPs belong to the DomUs and which are from the other machines in the network. This is easily done by doing a grep for the MAC prefix of the xen MAC addresses (if you have used automatic allocation of MAC addresses to the network cards of domUs ) On Thu, 30 Apr 2009, Pallab Chakrabarty wrote:> > > > Hi, > > > > I want to know the IP of a running VM in XEN.. Is there any way to have > this without login to that VM.. > > Any XEN tools ? > > - regards > Pallab > > > > >_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On Thu, Apr 30, 2009 at 2:40 PM, Pallab Chakrabarty <pchakrabarty@spikesource.com> wrote:> > > This would not yield my vm ip 10.1.1.130 > > Even arp -n don’t print about the bridge it uses.. > > > phy2:~ # brctl show > bridge name bridge id STP enabled interfaces > eth0 8000.0014c2e50258 no peth0 > > vif4.0 > > phy2:~ # arp -n > Address HWtype HWaddress Flags Mask > Iface > 10.1.1.11 ether 00:1O:09:D5:24:C8 C > eth0 > 10.1.1.1 ether 00:09:B7:3D:9A:C6 C > eth0 > 10.1.1.90 ether 00:0F:29:85:82:8D C > eth0 > 10.1.1.80 ether 00:1S:09:D4:A4:FC C > eth0 > 10.1.1.21 ether 00:13:22:B1:1F:5B C > eth0 > > > You see there''s no iface peth0 or vif4.0 got printed with arp ..You''re not familiar with the consept of Linux bridge or arp, are you? In that case, I''d say don''t bother. Bhasker was right in saying "The DomUs are like machines in the network and it is not easy to find the IP of the domU machines." While doing a ping-broadcast works (sometimes), there are cases when it won''t work (like when a server is set to ignore ping broadcast or all ping request). If you want to go the hard way and try it anyway, you might be able to do this : - find domU''s mac. This can be easy (if your domU config specify a static MAC) or could be hard. - tcpdump, filter that MAC address (I''ll get to the details later) The easy way to get domU''s IP address, you can look at domUs config file (if you specifiy it), or you can try running this xm network-list domU_name if you get this line Idx BE MAC Addr. handle state evt-ch tx-/rx-ring-ref BE-path 0 0 00:16:3E:F7:D6:E7 0 4 6 16238/16237 /local/domain/0/backend/vif/163/0 Then domU''s MAC is 00:16:3E:F7:D6:E7 The hard way to find out your MAC from a bridge, since your bridge is called eth0 you can try: - xm list, note the domain ID (the number) - brctl showstp eth0 that should show which interface is identified as which "port". For example if your domU has an ID 163, look for the lines that has "vif163.0" or "tap163.0". If the line looks like this vif163.0 (11) then that vif is identified as port 11 on the bridge. - brctl showmacs eth0 Look for the port corresponding to the port above. If you get this line 11 00:16:3e:f7:d6:e7 no 0.96 then on port11 (where your domU interface is) there''s a MAC address 00:16:3e:f7:d6:e7. Now that you have domU''s mac, you try snooping the bridge for that MAC. For example : # tcpdump -n -i eth0 ether src 00:16:3e:f7:d6:e7 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes 15:54:56.419482 IP 10.0.0.10 > 10.0.0.1: ICMP echo reply, id 5443, seq 1, length 64 15:54:57.422349 IP 10.0.0.10 > 10.0.0.1: ICMP echo reply, id 5443, seq 2, length 64 Then you know that domU has IP address 10.0.0.10. This is the HARD way to do it, since it requires domU to send/receive ethernet packet during the time you do all the above. Doing nmap -sP (like Bhasker suggest) might help get domU to respond (even if only with arp reply). Regards, Fajar _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Oh ! I think we are left with only doing a unicast ping which is the only method to get to the Xen machines. But I found this which may solve (partially) your issue suppose your network is 10.1.1.0/24 you can do nmap -sP 10.1.1.10/24 | grep -iB1 Xen this will give all IP addresses and mac address of Xen machines with the mac addresses of xen type (again if you chose not to change the default mac allocation of domUs) with the use of vifX number you can map it to your xen machine by looking at the mac address using ifconfig vifX.0 PS: The nmap does a ping sweep so ... expect a lot of icmp packets in your network ! On Thu, 30 Apr 2009, Pallab Chakrabarty wrote:> > > This would not yield my vm ip 10.1.1.130 > > Even arp -n don?t print about the bridge it uses.. > > > phy2:~ # brctl show > bridge name bridge id STP enabled interfaces > eth0 8000.0014c2e50258 no peth0 > > vif4.0 > > phy2:~ # arp -n > Address HWtype HWaddress Flags Mask > Iface > 10.1.1.11 ether 00:1O:09:D5:24:C8 C > eth0 > 10.1.1.1 ether 00:09:B7:3D:9A:C6 C > eth0 > 10.1.1.90 ether 00:0F:29:85:82:8D C > eth0 > 10.1.1.80 ether 00:1S:09:D4:A4:FC C > eth0 > 10.1.1.21 ether 00:13:22:B1:1F:5B C > eth0 > > > You see there''s no iface peth0 or vif4.0 got printed with arp .. > > But my vm is running in phy2 machine with 10.1.1.130 ip.. > > > Pls help .. > > > - regards > Pallab > > > > -----Original Message----- > From: Bhasker C V [mailto:bcv@bcv.uk.to] > Sent: Thursday, April 30, 2009 1:15 PM > To: Pallab Chakrabarty > Cc: Xen-users@lists.xensource.com > Subject: Re: [Xen-users] IP of a running VM in XEN > > Classic question. > > The DomUs are like machines in the network and it is not > easy to find the IP of the domU machines. > > Most of the times, the DomUs are connected to physical ethernet > of Dom0 via bridge. So arp on the bridge must show the ip > addresses in that machine. > > I usually do a > > ping -b 255.255.255.255 > which will make all the machines to reply. Once this is done, within a > short period if we try to do a arp information > > arp -n > > you will get a list of ip addresses. The only problem is to sort out > which IPs belong to the DomUs and which are from the other machines > in the network. This is easily done by doing a grep for > the MAC prefix of the xen MAC addresses (if you have used automatic > allocation of MAC addresses to the network cards of domUs ) > > > On Thu, 30 Apr 2009, Pallab Chakrabarty wrote: > >> >> >> >> Hi, >> >> >> >> I want to know the IP of a running VM in XEN.. Is there any way to have >> this without login to that VM.. >> >> Any XEN tools ? >> >> - regards >> Pallab >> >> >> >> >> > > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 8.0.238 / Virus Database: 270.12.9/2087 - Release Date: 04/29/09 > 18:03:00 > > _______________________________________________ > Xen-users mailing list > Xen-users@lists.xensource.com > http://lists.xensource.com/xen-users >_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users