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

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\}'

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

Tags:

Parallels