Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get IP from virsh
#add this to your bashrc
virsh_ip(){
mac=`virsh dumpxml $1 | grep "mac address" | tr -s \' ' ' | awk ' { print $3 } '`
for i in `seq 1 10`; do
ip=`arp -na | grep $mac | awk '{ print $2 }' | tr -d \( | tr -d \)`
if [ "$ip" = "" ]; then
sleep 1
else
break
fi
done
echo $1 has MAC: $mac and IP: $ip
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.