Created
May 3, 2018 11:27
-
-
Save aastaneh/43e327be9da6b930e8063b7529155254 to your computer and use it in GitHub Desktop.
a terrible bash script that uses the ARP table to determine IP addresses for running KVM guests on a bridged interface
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/bash | |
for vm in $(virsh list --state-running --name); do | |
echo -n "$vm " | |
arp | grep $(virsh domiflist $vm | sed '/^$/d' | tail -n1 | awk '{ print $NF}') | awk '{ print $1 }' | |
done | |
# $ script.sh | |
# vm1 192.168.1.100 | |
# vm2 192.168.1.101 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment