I use Juniper Networks network connect to connect to the office network. Once i am inside the office network, i check the server ips and add entries for them in /etc/hosts file like,

10.199.xx.yy  offi

When i come out of the VPN network into public domain, network connect resets all changes it made and brings my /etc/hosts file to the state it was in before entering the network. I think, this behaviour is Juniper Network connect's expected behaviour as it adds an entry on the top of the hosts file as,

# BEGIN hosts added by Network Connect
61.xx.yy.zz  vpn.ip.com
# END hosts added by Network Connect

But in trying to reset its own entries, network connect reset the user made entries as well..

I tried to make /etc/hosts as immutable using chattr +i /etc/hosts but that caused my vpn login to fail as network connect comes out, if it fails to write into /etc/hosts


1 Answer 1


Based on your question I can't tell whether IP/hostname mappings are permanent in your office. If they are, you might want to make a little script that resets the /etc/hostsfile:

cat > /etc/hosts <<EOF   foo   bar   baz   quux

and that you run when you want to reset the IP/hosts mappings.

You must log in to answer this question.