1

I have the following lines in my /etc/hosts. Parallels Desktop keeps commenting lines which as it needs to connect to that domain. I tried changing access of /etc/hosts to 444 but it suddenly changed to 644.

It seems like Parallels Desktop needs to edit /etc/hosts to define hosts on its local network.

How can block access of Parallels Desktop from these domains without changing /etc/hosts?

1
  • I posted an answer a while ago, and I'm wondering if it helped you solve the issue. If it did, I'd appreciate it if you could mark my answer as accepted, that will display your question as solved and will help others with a similar problem. Thanks in advance!
    – jaume
    Commented Sep 22 at 10:59

1 Answer 1

2

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:

  1. Open the /Library/Preferences/Parallels/network.desktop.xml file and locate the following line:

    <NATDAllowEtcHostsWrite>1</NATDAllowEtcHostsWrite>

  2. 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).

4
  • Do you understand why Parallels is adding itself to Hosts? As in, what is it trying to achieve? As a non-user of Parallels, this seems fairly invasive. Commented Oct 9, 2022 at 16:21
  • 1
    @Wowfunhappy The rationale behind this is that the user can then access a VM by hostname instead of by IP address, which is certainly convenient, for example when connecting with SSH to a VM. However, I agree with you, and would expect this to be: 1) disabled by default 2) easily configurable with the GUI instead of with some obscure XML file.
    – jaume
    Commented Oct 9, 2022 at 17:17
  • 1
    Thanks! I would encourage you to add the rationale to your answer. This will also let people know the consequences of turning it off. Commented Oct 9, 2022 at 23:08
  • @Wowfunhappy Good point, I've expanded the answer with the rationale.
    – jaume
    Commented Oct 10, 2022 at 6:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .