Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting IP Address of QEMU Guest #3

Closed
prologic opened this issue Mar 4, 2018 · 12 comments
Closed

Getting IP Address of QEMU Guest #3

prologic opened this issue Mar 4, 2018 · 12 comments

Comments

@prologic
Copy link

prologic commented Mar 4, 2018

So I did a bit of research and found what I believe is a viable and reliable way of getting the IP Address of a QEMU Guest.

$ qm agent 302 network-get-interfaces | jq -r '.[] | select(."hardware-address" == "42:24:09:dd:1c:73") | ."ip-addresses" | .[] | ."ip-address"'

Basically this requires that the qemu-guest-agent is installed on the guest and qemu-ga daemon is running. You can then either run qm agent <vmid> <command> or probably talk tot he UNIX sokcet directly on the PRmoxox VE host.

@prologic
Copy link
Author

prologic commented Mar 4, 2018

A fallback mechanisms would be to run arp -a on the host. This gives you an output like this:

root@vz1:~# arp -a
? (10.0.0.14) at 36:32:31:61:32:66 [ether] on vmbr0
? (10.0.0.1) at 4c:5e:0c:a0:a6:25 [ether] on vmbr0

@lnxbil
Copy link
Owner

lnxbil commented Mar 5, 2018

Both are viable, yet I do not know if the qemu-agent gets installed in the boot2docker iso

@prologic
Copy link
Author

prologic commented Mar 5, 2018

I'm actually more interested in RancherOS myself and filed rancher/os#2267 for this very reason.

I think using qemu-guest-agent is going to be more reliable; so I would almost make this a hard requirement that if you want to use this driver, your guest better have this agent installed and running.

@lnxbil
Copy link
Owner

lnxbil commented Mar 5, 2018

Yes, I agree. I've never tried something else besides the default docker machine OS, so I'm open to this.

@prologic
Copy link
Author

prologic commented Mar 5, 2018 via email

@lnxbil
Copy link
Owner

lnxbil commented Apr 16, 2018

I just stumbled over your entry in RancherOS by chance .. Good to know that we're going to have support in RancherOS. I haven't found any entry in the boot2docker issue tracker about this. Are so few people using KVM/QEMU and docker?

@lnxbil
Copy link
Owner

lnxbil commented Apr 16, 2018

You idea with RancherOS works perfectly. We're going to make this the default:

root@proxmox4 ~ > pvesh create nodes/proxmox4/qemu/7321/agent -command network-get-interfaces
200 OK
{
...
     {
         "hardware-address" : ....
         "ip-addresses" : [
            {
               "ip-address" : "1.2.3.4",
               "ip-address-type" : "ipv4",
               "prefix" : 16
            },
            ....
      },
...
}

@prologic
Copy link
Author

prologic commented Apr 16, 2018 via email

@lnxbil
Copy link
Owner

lnxbil commented Apr 16, 2018

In addtion, I just build Boot2Docker with support for QEMU Guest Agent and created a pull request in boot2docker/boot2docker#1319. This actually works right now!

@prologic
Copy link
Author

prologic commented Apr 16, 2018 via email

@lnxbil
Copy link
Owner

lnxbil commented Apr 18, 2018

So, we can close this, because the detection works now.

@lnxbil lnxbil closed this as completed Apr 18, 2018
@prologic
Copy link
Author

prologic commented Apr 19, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants