Change advanced wifi settings

So, here's my particular use case but I'm sure there could be other uses..

I'd like to change the DNS settings for my wifi connection in order to block ads (by pointing to an ad blocking/malware blocking dns server), but only under certain circumstances - most of the time I'm fine with ads. However it's too cumbersome to manually change dns settings every time, so if autotools could do that (and also change other advanced wifi settings where possible) that would be great.