# File lib/vagrant-libvirt/action/prepare_nfs_settings.rb, line 57 def read_machine_ip(machine) # check host only ip ssh_host = machine.ssh_info[:host] return ssh_host if ping(ssh_host) # check other ips command = "ip=$(which ip); ${ip:-/sbin/ip} addr show | grep -i 'inet ' | grep -v '127.0.0.1' | tr -s ' ' | cut -d' ' -f3 | cut -d'/' -f 1" result = '' machine.communicate.execute(command) do |type, data| result << data if type == :stdout end ips = result.chomp.split("\n").uniq @logger.info("guest IPs: #{ips.join(', ')}") ips.each do |ip| next if ip == ssh_host return ip if ping(ip) end end