How to set custom DNS entry for a particular wifi connection

dnsNetworkwifi

Is there a way to set custom DNS settings for a single wifi connection without affecting other connections?

I use my laptop at home and work. When at work I need to type in an IP address of a local DNS server to resolve company resources. I currently do this by pressing the "Advanced…" button on the network preferences page. Unfortunately this setting is global for all of my wifi connections. So when I go home I need to remove the DNS setting.

Can I set the DNS setting to only work while I'm connected to the company's wifi?

Best Answer

What you want to do is Add a Network Location for work.

You can then easily switch between them using the Location submenu of the  menu.

If you really wanted, you could set up a script to switch locations based on network, but really, how lazy do you want to be? ;)