My answer is a combination of the above because I am connecting to my office via Fortinet SSL VPN for Ubuntu 16.04.
The first thing I had to do is bring up my terminal console and run the following command:
sudo nano /etc/resolvconf/resolv.conf.d/base
I added the following example:
searchdomain domain.local
nameserver xxx.xxx.xxx.xxx
nameserver xxx.xxx.xxx.xxx
Then I saved the file by pressing CTRL-O
and closed nano by pressing CTRL-X
.
I then did the following and it worked perfectly:
To make Chrome respect the new entry, do the follwing:
Edit /etc/hosts
as @Renan described.
- Go to
chrome://chrome/settings/clearBrowserData
.
- Choose since the beginning of time.
- Check Empty the cache, but uncheck everything else.
- Click Clear browsing data and wait for it to finish.
- Restart Chrome.
Chrome should respect your hosts file now.
1Thank you. I just changed the /etc/hosts file on my Mac to
127.0.0.1 www.google.com
. However, google.com still leads to the Google home page. Do I need to refresh anything? Should I restart my computer? – David Faux – 2012-06-03T03:30:16.073You shouldn't need to. Try adding
127.0.0.1 google.com
(without the www) after this line and check whether it works. – Renan – 2012-06-03T03:31:58.283127.0.0.1 google.com
isn't working either. I'm not sure what's going on ... I know that/etc/hosts
is a soft link to/private/etc/hosts
on a Mac, but I don't think that helps at all. – David Faux – 2012-06-03T03:53:34.673Does
127.0.0.1 www.example.com
, then acessing www.example.com, works? – Renan – 2012-06-03T03:54:09.073No, http://www.example.com still oddly leads to http://www.iana.org/domains/example/ on my Mac with
– David Faux – 2012-06-03T03:57:17.257127.0.0.1 www.example.com
as my /etc/hosts file.1A technicality:
hosts
maps hostnames to IP addresses, not vice versa. – Dennis – 2012-06-03T04:43:17.4201@Dennis, that’s what I was going to say, but then again, it really does work both ways when you think about it, because it creates an association between two items. – Synetech – 2012-06-03T04:46:54.973