[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-users] IP of a running VM in XEN


  • To: Xen List <xen-users@xxxxxxxxxxxxxxxxxxx>
  • From: "Fajar A. Nugraha" <fajar@xxxxxxxxx>
  • Date: Thu, 30 Apr 2009 16:01:17 +0700
  • Delivery-date: Thu, 30 Apr 2009 02:02:06 -0700
  • List-id: Xen user discussion <xen-users.lists.xensource.com>

On Thu, Apr 30, 2009 at 2:40 PM, Pallab Chakrabarty
<pchakrabarty@xxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.