How to make changes to Mac /etc/hosts permanent?
I've had the same issue. In my case I'm using F5 VPN client. You shouldn't edit /etc/hosts
while VPN client is running, because these changes will be erased when you shut down the VPN client. To make your changes permanent, edit /etc/hosts
file before you start your VPN client.
You are using Cisco AnyConnect software, which will overwrite /private/etc/hosts
with /private/etc/hosts.ac
. Just edit that file instead.
I also had this problem with the Pulse Secure VPN client, which makes a file /etc/pulse-hosts.bak that you should edit too. Editing /etc/hosts before launching Pulse also works.