Wednesday, February 24, 2016

linux - Resolve all external addresses to an internal address when an internet connection is missing

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.

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...