0

I am using a raspberry-pi running ArchLinux with a WiFi router to provide an access point for locally-hosted web content. I am running a DHCP server. When the Pi is plugged into an internet connection, clients connected to it's WiFi network can access any webpage online as well as accessing locally hosted content (via 10.1.0.1).

When an internet connection is not present, I would like all DNS requests to route to 10.1.0.1. However, I only want this behavior to occur if the DNS request to the real webpage (say www.google.com) does not resolve. How can I conditionally resolve all external addresses to the internal address, only when external internet access is not possible?

This question is similar to How can i resolve all external addresses to internal address?, but I am not clear how to apply dnsmasq conditionally, or whether dnsmasq is the correct tool for my use case.

  • I would be tempted to setup a tool like monit. Set monit to monitor your connection. If the connection is down, have monit run a script that modifies the DNS server configuration as needed. Likewise you would create a script to return the system to normal when the system is back up. – Zoredache Jun 17 '14 at 21:39
  • 1
    BTW, the question you linked to had a better answer here. serverfault.com/questions/351108/… – Zoredache Jun 17 '14 at 21:46
0

That's not exactly what you asked for but I don't think you can find a way to do it as presented. On the other RMS, one approach could be to setup a DNS server with 2 forwarders: - 1 located on the internet like opendns or so… - 1 local that resolves only to the desired internal IP address

When your internet connection is down you can't reach the first forwarder so you'll fallback to the second one that dumbly answers the same thing every time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.