Skip to main content
Source Link
Eiver
  • 1.3k
  • 2
  • 9
  • 9

How to redirect http requests to local Apache server on internet connection lost?

I have a little Linux (Ubuntu based) server with 2 network cards, which acts as a router, dhcp, dns server, firewall, etc. One network card is connected to the LAN, while the other is connected to my ISP. When the Internet link is down, I would like to redirect all http requests to my local Apache server, which would display a little webpage informing my LAN users, that their LAN connection is OK, the server itself is OK, only the ISP link is currently down. How would I do that?

  1. I found no reliable way to detect if the Internet connection is down, other than periodically pinging a bunch of external hosts that are known to be up most of the time. (The status of the interface is UP all the time).

  2. What tool should I use for redirection? Iptables? Something else?