how to know the IP address of a VM

jluc2808

New Member
Mar 22, 2019
16
0
1
69
Hello,
i have installed a VM which is build on a debian-x86.7-1 iso
the VM is running and i could enter the console SPICE to run android.

as i would like to install HA-Bridge inside a VM , i want to enter a SSL session on that VM , where coul I find the IP address ?

surely a noob question ?

thanks
 
you configure the ip inside the vm so you can look there
from outside that is not so easy but maybe you can find out with 'arp -a' provided the host and the guest are in the same subnet and have communicated in the recent past
 
where you want to see the ip address? inside the vm? try "ifconfig" in a console, or "ip a". If "ifconfig" not works, install it with "apt-get install net-tools"
outside the vm via browser? activate "qemu agent" at options in the vm config, and install inside the vm "apt-get install qemu-guest-agent" - then the ip will be shown outside the vm at the browser in the proxmox gui
 
from inside : I'm surely completly noob , but i don't find where is stored the IP inside the VM , when i look at the material , i get only the mac address under IP ?
from outside ???? where i could type this command line (from SSL to proxmox ?)
best regards
 
where you want to see the ip address? inside the vm? try "ifconfig" in a console, or "ip a". If "ifconfig" not works, install it with "apt-get install net-tools"
outside the vm via browser? activate "qemu agent" at options in the vm config, and install inside the vm "apt-get install qemu-guest-agent" - then the ip will be shown outside the vm at the browser in the proxmox gui
thanks for this reply , the pb is , when i start the VM, i enter inside android display, the only app i could use is terminal-emulator adi have setted super-privileged , when i want to use
- apt-get i get unknow command
- if i make an su root , idem
- if i make su -s apt-get the response not permitted

sorry again if this is obvious
 
Inside the vm - do you have a terminal in the vm? and are you user root? there you will need a command line e.g. root@debiantest1:~#
If you have a graphical installation with debian, you should open a terminal to get the command line tool. And there you enter "ip a" and it should show you the ip configuration.
You can also install at the terminal the qemu-guest-agent inside the vm, this is necessary to "passthrough" the ip adress to the proxmox gui - this you install with "apt-get install qemu-guest-agent" also in the vm at the terminal. Dont forget to activate qemu guest agent at the vm - klick in the proxmox gui on the vm, then options and activate qemu agent. Shutdown vm and start it new - the ip should be shown at the proxmox gui. Do not reboot, that takes no effect of changing options of a vm.

best regards, roman
 
  • Like
Reactions: symrex
i got the IP form the terminal-emulator with ip-a ==> 192.168.1.52
but i 'm unable to install something (sudo apt-get install xx) or to connect with SSL

so i decide to follow your recommandation
when i want to install qemu-guest-agent i get an error (on the proxmox system)

admin@proxmox:~$ sudo apt-get install qemu-guest-agent
[sudo] password for admin:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
qemu-guest-agent
0 upgraded, 1 newly installed, 0 to remove and 29 not upgraded.
1 not fully installed or removed.
Need to get 315 kB of archives.
After this operation, 1,270 kB of additional disk space will be used.
Get:1 http://ftp.fr.debian.org/debian stretch/main amd64 qemu-guest-agent amd64 1:2.8+dfsg-6+deb9u5 [315 kB]
Fetched 315 kB in 0s (1,400 kB/s)
Selecting previously unselected package qemu-guest-agent.
(Reading database ... 54807 files and directories currently installed.)
Preparing to unpack .../qemu-guest-agent_1%3a2.8+dfsg-6+deb9u5_amd64.deb ...
Unpacking qemu-guest-agent (1:2.8+dfsg-6+deb9u5) ...
Setting up libvirt-daemon-system (3.0.0-4+deb9u3) ...
Job for libvirtd.service failed because the control process exited with error code.
See "systemctl status libvirtd.service" and "journalctl -xe" for details.
invoke-rc.d: initscript libvirtd, action "start" failed.
● libvirtd.service - Virtualization daemon
Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Fri 2019-04-12 12:54:01 CEST; 9ms ago
Docs: man:libvirtd(8)
http://libvirt.org
Process: 10571 ExecStart=/usr/sbin/libvirtd $libvirtd_opts (code=exited, status=6)
Main PID: 10571 (code=exited, status=6)
CPU: 56ms

Apr 12 12:54:01 proxmox systemd[1]: Failed to start Virtualization daemon.
Apr 12 12:54:01 proxmox systemd[1]: libvirtd.service: Unit entered failed state.
Apr 12 12:54:01 proxmox systemd[1]: libvirtd.service: Failed with result 'e…de'.
Hint: Some lines were ellipsized, use -l to show in full.
dpkg: error processing package libvirt-daemon-system (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up qemu-guest-agent (1:2.8+dfsg-6+deb9u5) ...
Processing triggers for systemd (232-25+deb9u9) ...
Processing triggers for man-db (2.7.6.1-2) ...
Errors were encountered while processing:
libvirt-daemon-system
E: Sub-process /usr/bin/dpkg returned an error code (1)
 
* You need to install the qemu-guest-agent inside the guest - the hypervisor/proxmox side is enabling the Guest agent flag in the VM config (in the GUI -> VM -> 'Options')

* libvirt is incompatible with PVE - PVE uses it's own stack to run KVM (and LXC) - please remove the package and make sure that the 'proxmox-ve' metapackage is installed.

Hope this helps!
 
  • Like
Reactions: AlBayrouni
ok i have remove libvir* package , clean with autoremove , re-installed in Proxmox-Ve qemu-guest-agent, setted qemu agent in my VM (activated)
but when i run the VM and look at the resume screen : i get
IPs Guest Agent not running
i cannot access to the apt-get install function (i'm running a terminal emulator inside android debian 7) even if set su root, no way

i'm surely wrong somewhere and i surely miss something

when i edit : sudo nano /etc/pve/qemu-server/102.conf (my VM)
the contents is
Code:
agent: 1
balloon: 1280
bootdisk: scsi0
cores: 2
cpu: core2duo
ide2: local:iso/android-x86-7.1-r2.iso,media=cdrom
memory: 2000
name: Proxmox-android
net0: virtio=9A:C5:49:48:93:ED,bridge=vmbr0
numa: 0
onboot: 1
ostype: l26
scsi0: local-lvm:vm-102-disk-0,size=32G
scsihw: virtio-scsi-pci
smbios1: uuid=99bb2f19-a2ca-4828-b16e-6cc55ddf757b
sockets: 1
tablet: 0
vga: qxl
vmgenid: c0fcb236-2639-4e93-b188-4510fc9f8780
 
ok i have remove libvir* package , clean with autoremove , re-installed in Proxmox-Ve qemu-guest-agent, setted qemu agent in my VM (activated)
You need to install qemu-guest-agent inside the guest
 
Yes I understand and try to do that part, but as I said I couldn't open a ssh session on the guest till I have installed this soft. So it's a snake biting his tail, if I want to access ssl I need to install qemu-guest-agent but to install this I need ssl session?
 
You can access the VM's console via GUI - there you should be able to find the ip it currently is having - with the tools of the guest OS
(`ip addr show` should work on most recent linux distros, `ifconfig -a` on BSDs, `ipconfig /all` on Windows)

If the guest gets its ip via dhcp - you can look it up in the dhcp logs as well
 
You can access the VM's console via GUI - there you should be able to find the ip it currently is having - with the tools of the guest OS
(`ip addr show` should work on most recent linux distros, `ifconfig -a` on BSDs, `ipconfig /all` on Windows)

If the guest gets its ip via dhcp - you can look it up in the dhcp logs as well

I am expecting a command or a tool to obtain the IP address from the host not the guest.
 
nslookup is your friend. Or you just look in the GUI after installing qemu-guest-agent in the VM.
 
* You need to install the qemu-guest-agent inside the guest - the hypervisor/proxmox side is enabling the Guest agent flag in the VM config (in the GUI -> VM -> 'Options')

* libvirt is incompatible with PVE - PVE uses it's own stack to run KVM (and LXC) - please remove the package and make sure that the 'proxmox-ve' metapackage is installed.

Hope this helps!
i have already tried installing libvirt, and ended ups seeing proxmox pakages being removed
thanks a lot for mentioning this
 
I am expecting a command or a tool to obtain the IP address from the host not the guest.
Without installed guest-agent but only unsing generic Linux tools:

Look for the mac address in the configuration of the vm. In my example: vmid = 1176

Code:
~# qm config 1176 | grep net
boot: order=scsi0;ide2;net0
net0: virtio=4E:57:9F:01:4E:6F,bridge=vmbr12,firewall=1

Now you can use "arp" to get the current IP address from the MAC:

Code:
~# arp -n | grep -i 4E:57:9F:01:4E:6F
10.12.4.59               ether   4e:57:9f:01:4e:6f   C                     vmbr12
 
Hi all,

So there's also the (longer way) of leveraging the QEMU Agent and the Proxmox API via pvesh to get those information:
Code:
# pvesh get /nodes/<hostname>/qemu/<vmid>/agent/network-get-interfaces
Remember to replace <hostname> and <vmid> with your specific information.

I suggest to use a slightly modified version of the command, parsing with jq:
Code:
# pvesh get /nodes/pve/qemu/201/agent/network-get-interfaces -o json | jq

Of course, the QEMU Guest Agent must be installed in the guest and enabled in the VM configuration.

Regards,
 
Just want to add the full jq query for this:

Code:
pvesh get /nodes/cloud/qemu/115/agent/network-get-interfaces -o json | jq '.result[] | select(.name == "eth0") | .["ip-addresses"][] | select(.["ip-address-type"] == "ipv4") | .["ip-address"]'
"192.168.1.122"
 
  • Like
Reactions: UdoB

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!