The issue I am facing:
I've had my pi-hole up and running for about a week now, and everything is working very smoothly on my home wifi. However, if I were to take my laptop to work, or to a public wifi area, etc., I wouldn't be able to use the pi-hole (no vpn at the moment) and would need to go straight to the upstream dns servers, or my workplace's dns servers etc. What is the best way to handle this?
Details about my system:
The pi-hole is running on a raspberry pi 2 running a minimal debian installation.
In my case, I'm using a custom live debian disk that I take back and forth from work to home. But the same issue would be present in the case of taking a laptop as I mentioned above. I'm using debian stable without the network-manager package installed (and have no desire to install it).
Simply putting the IP of the pi-hole in /etc/resolv.conf gets the pi-hole working at home. If I put the name of another dns server under that line in /etc/resolv.conf, my system uses it when the pi-hole is unavailable, but it introduces significant latency because I have to wait for the query to the pi-hole to timeout.
From searching around similar issues, I see that some people recommend using dnsmasq to handle this. I've tried installing dnsmasq, changing the dns server in /etc/resolv.conf to 127.0.0.1, and including the pi-hole's IP in /etc/dnsmasq.conf. If I do this the pi-hole still works on my home network.
That's as far as I have gotten though. I thought that if I include the IP of the second dns server and something like "server=/local/pi-hole's IP" in /etc/dnsmasq.conf, I would get the behavior I was hoping for, but if I do that, dns queries don't resolve at all, so I think I'm either on the wrong track entirely or have missed a step somewhere.
What I have changed since installing Pi-hole:
I've turned off dhcp in my router and turned it on in the pi-hole.
On the raspberry pi 2's debian installation, I've changed the repository mirrors to closer servers, upgraded a few packages, installed locales, and changed the timezone. That's all. It's still a very minimal install with a little under 300 packages installed.
I'd like the system to smoothly switch dns servers depending on which network I'm connected to. Does anyone have any ideas about how I can do that?