Vboxmanage querying a running vbox virtual machine

Source: Internet
Author: User

System: Linux Universal, virtualbox5.0

Each time the VM virtual machine is started with the following command, it is found that there is no way to know its IP.

$ vboxmanage STARTVM <vmname>--type Headless

According to some of Google's commands, also can not find out, so found a foreign buddies to use ARP method to find the online LAN host method to change to a script, currently support a single online virtual machine, I have time to change to a multi-user.

#!/bin/bash

#This shell script can find the IP of running VirtualBox system
#But now (2016/04/18 23:20[beijing]), it is only use to find one running VirtualBox system
#此脚本用户找到birdge方式单台在运行的virtualbox虚拟机ip
Vmname= ' vboxmanage list Runningvms | Awk-f ' "' {print $} '
if [!-n "VMNAME"];then
For i in {100..120}
Do
Ping-c 1 192.168.1. $i &>/dev/null
Done

Vmmac= ' Vboxmanage showvminfo ${vmname} |grep ' MAC ' |awk ' {print $4} ' |awk-f ', ' {print '} ' | Sed-r ' s/^ (. { 2}) (. { 2}) (. { 2}) (. { 2}) (. { 2}) (. { 2})/\1:\2:\3:\4:\5:\6/"
vmip= ' Arp-a | Grep-i $VMMAC |sed ' s/^.* (. *\). *$/\1/"
Echo $VMIP
Else
echo "Enn ..., not have running VirtualBox system."
Fi

Vboxmanage querying a running vbox virtual machine

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.