[PVE-User] How to see IP address of guest VM

Paul Gray gray at cs.uni.edu
Thu Jun 14 12:44:28 CEST 2012


On 06/14/2012 04:57 AM, Paul Gray wrote:
> On 06/14/2012 12:42 AM, Jewel Nuruddin wrote:
>> sorry, I am not a developer, as some other can show IP that's why I
>> though proxmox also implement the same thing.
>>
>
> I'd suggest that a low-friction way to get the information that you're
> after is to simply run arpwatch on the bridges to watch for MAC-IP
> bindings. You could then periodically (or on-demand) pull the output
> from arpwatch and push it through a grep of the MACs found in the server
> .conf files.
>

Just a quick followup to state that this indeed "works for me" in the 
sense that anything that's on the network gets picked up.

I describe the process below, which is not "the requested solution," but 
if one were to tweak what I outline below so as to:
   * Pull the MAC and the IP from the arpwatch output
   * grep the conf files for a corresponding MAC match. Find the
     MAC for the IP found in the arpwatch output
   * lock the corresponding server's conf file
   * sed or echo
    "# arpwatch found the IP address ${IPADDR} bound to ${VMNET}"
     into the conf file (So that it will show up in the comment field
     in the GUI.
   * unlock the conf file.

More details:

My Proxmox servers are named vm1-vm8  and clustered:
# Install arpwatch
root at vm1:~# apt-get install arpwatch

# Pull all interfaces
root at vm1:~# for x in $(ifconfig -a | grep Link | grep HW | awk '{print 
$1}'); do echo $x -m root >> /etc/arpwatch.conf ; done

# Restart arpwatch
root at vm1:~# /etc/init.d/arpwatch restart

This is where the "elegant solution" and the "expedient solution" 
diverge a bit:  The "best" approach would be to pull the data directly 
from the arpwatch databases.  But the "expedient" approach is to pull 
the results from /var/log/syslog.  The log entries that you want look 
something like this:
  root at vm8:~# grep arpwatch: /var/log/syslog | grep "new station"
<clip>
Jun 14 05:35:56 station245 arpwatch: new station 172.16.219.100 
a6:e5:68:a4:3f:f2 vmbr0
Jun 14 05:35:56 station245 arpwatch: new station 172.16.219.100 
a6:e5:68:a4:3f:f2 tap101i0
Jun 14 05:35:56 station245 arpwatch: new station 172.16.219.100 
a6:e5:68:a4:3f:f2 eth0
Jun 14 05:35:56 station245 arpwatch: new station 172.16.219.100 
a6:e5:68:a4:3f:f2 eth0

The above is one of my VMs.  From this output, the mac and matching IP 
can be pulled. With the MAC in hand, one can find a match in 
/etc/pve/qemu-server/*.conf.  With the conf file locked, you can then 
drop the corresponding IP in the conf file as a comment so as to show up 
in the GUI.  This is easy to do expediently, but the bash/awk/sed
prototype that I wrote for proof of concept (which is working) isn't 
suitable for posting here just yet.

-- 
Paul Gray                                         -o)
314 East Gym, Dept. of Computer Science           /\\
University of Northern Iowa                      _\_V
  Message void if penguin violated ...  Don't mess with the penguin
  No one says, "Hey, I can't read that ASCII attachment ya sent me."



More information about the pve-user mailing list