Configure Parallels Desktop to stop editing /etc/hosts
You don't mention which domains you are trying to block access to, but you can configure Parallels Desktop to stop fiddling with /etc/hosts
, which will hopefully prevent this issue.
According to this Parallels Knowledge Base article, you can prevent Parallels Desktop from updating /etc/hosts
as follows:
Open the /Library/Preferences/Parallels/network.desktop.xml
file and locate the following line:
<NATDAllowEtcHostsWrite>1</NATDAllowEtcHostsWrite>
Set the setting above to "0" (disabled) so that no records will be created in the /etc/hosts
file.
Note that turning this setting off won't let you access a VM by hostname. Instead, you will have to use its IP address, which can be inconvenient, for example when connecting with SSH to a VM.
More information
In Parallels Desktop Pro Edition a virtual machine's name will be automatically registered in the host's /etc/hosts records if the following statements are true:
- The VM is in Shared or Host-Only network mode;
- and the VM gets an IP address from DHCP (not a static).
For example, say you have a VM named rhel6.3
which is in shared networking mode with the DHCP-assigned IP 10.211.55.4
. When you start the VM, a new record will be created in /etc/hosts
:
10.211.55.4 rhel6.3 rhel6.3.shared #prl_hostonly shared
Now, by using either the rhel6.3
or rhel6.3.shared
name, this VM can be accessed from the host or any other VM in the shared networking group.
Use firewall software
Alternatively, if the above method doesn't work, you can block the domains by using a firewall software like Little Snitch (Little Snitch offers a free trial).