Domanda

Parallels has a command line API which is documented here

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

Still, even with this the IP_ADDR reported is always empty, even if the machine is running as has an internet connection.

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

È stato utile?

Soluzione

If it's a Windows VM, you can get the IP with 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 a *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\}'

Altri suggerimenti

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 prompt as root to the VM if you want the 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 host linux machine (if using windows do ipconfig instead of ifconfig)

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

I stumbled upon this today and found it questionable that the list command shows an IP_ADDR but never the IP. I checked the most recent docs for the prlctl command and its states:

-f, --full

Shows the real IP address(es) for running virtual machines.

Providing this flag displays the IP addresses for me

prlctl list -f

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top