libvirtdな環境で、ゲストに割り当てられたIPアドレスを見るのはどうやんだっけーと思って、virsh helpで調べたのでメモ。 まあ、net系のオプションだよなーと思って見てみたらnet-dhcp-leasesというのがあって、これっぽいよなと試したら正解だった。
使い方は↓の通り。
masami@saga:~$ sudo virsh net-dhcp-leases default Expiry Time MAC address Protocol IP address Hostname Client ID or DUID ------------------------------------------------------------------------------------------------------------------- 2015-07-18 16:02:20 52:54:00:8b:ca:be ipv4 192.168.122.161/24 - ff:00:8b:ca:be:00:01:00:01:1d:3c:a8:69:52:54:00:8b:ca:be 2015-07-18 16:30:14 52:54:00:8b:ca:be ipv4 192.168.122.162/24 - ff:00:8b:ca:be:00:01:00:01:1d:3c:ab:15:52:54:00:8b:ca:be 2015-07-18 16:30:54 52:54:00:a1:c8:2b ipv4 192.168.122.210/24 ktest-autotest ff:00:a1:c8:2b:00:01:00:01:1d:3c:55:3c:52:54:00:a1:c8:2b 2015-07-18 16:35:38 52:54:00:a4:da:88 ipv4 192.168.122.66/24 kerntest ff:00:a4:da:88:00:01:00:01:1d:33:21:b4:52:54:00:f7:c2:6c 2015-07-18 16:16:23 52:54:00:f7:c2:6c ipv4 192.168.122.65/24 fedora-test ff:00:f7:c2:6c:00:01:00:01:1d:33:21:b4:52:54:00:f7:c2:6c
書式はこうですね。 virsh net-dhcp-leases [network name]