How to get the IP address used by Parallels VM from the host?

Parallels has a command line API, which is documented here.

>prlctl list UUID STATUS IP_ADDR NAME {ca50aac6-caa6-47a6-9bfe-e38f6261cb8d} running - win7 

However, even so, the reported IP_ADDR is always empty, even if the machine is operating as it has an Internet connection.

How can I find the IP address of a machine from a guest? I need a way to connect to a guest using a domain name or IP.

+6
source share
2 answers

If it is a Windows virtual machine, you can obtain the IP address using the following command from the host:

 prlctl exec "VM Name" ipconfig | grep "IPv4" | grep -o '\d\{1,3\}\.\d\{1,3\}\.\d\{1,3\}\.\d\{1,3\}' 

For * nix VM:

 prlctl exec "VM Name" ifconfig eth1 | grep "inet " | grep -o 'addr:\d\{1,3\}\.\d\{1,3\}\.\d\{1,3\}\.\d\{1,3\}' | grep -o '\d\{1,3\}\.\d\{1,3\}\.\d\{1,3\}\.\d\{1,3\}' 
+12
source

if you want to access the machine using SSH, there is a built-in command that can help with this.

prlctl enter <VM_ID|VM_NAME>

This will open a request with administrator rights if you want IP for any other reason, there is another way to get it

prlctl exec <VM_ID|VM_NAME> ifconfig

The exec command from prlctl will execute the ifconfig command on the Linux host machine (if using ipconfig instead of ifconfig )

All ifconfig output will be printed on your terminal and ip will be clearly visible on output

+7
source

Source: https://habr.com/ru/post/950422/


All Articles