I have to check website performance through various webproxies from my Fedora 19 box, and I want to do that by setting a local resolvable name "proxy" to the DNS resolved names for our proxies in my /etc/hosts
file. So, contents of /etc/hosts
file should look something like this:
proxy.us.company.com proxy
#proxy.eu.company.com proxy
#proxy.sa.company.com proxy
Then when I need to test a different proxy, I can just edit the /etc/hosts
file and uncomment a different proxy DNS name, and all my logins (and everyone else using my machine) will be checking against the new proxy. And most of the above DNS names are round-robin entries which is also fine and required for my testing. (Truth be told, I also need this for actual work, because every once in a while proxy.us gets bogged down and one of the other proxies ends up being faster than proxy.us.)
How do I go about doing this? I did consider writing a script to change the http_proxy
env variable, but with that method I would need to add an additional step to every process to align all my logins' variables together. I want to change it in just once place. /etc/hosts
seems the most logical place to make a system-wide name resolution change like this.