Created
August 1, 2013 09:14
-
-
Save public/6129776 to your computer and use it in GitHub Desktop.
Get the IP address of the named running KVM VM. ./virt-ip.sh YOUR-VM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
grep $(virsh domiflist $1 | grep -vE '^((.)\2*)?$' | awk 'NR == 1 { for(i=1; i <= NF; i++) { if($i == "MAC") { MAC=i } } } NR > 1 { print $MAC }') /var/lib/libvirt/dnsmasq/default.leases | cut -d\ -f3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment