Routing domain on lan

domain-name-systemlocal-area-networkrouting

I have LAN setup with public server on it. The server is accessible via domain example.com. If I access example.com from within lan, it goes over my ISP. I wish it went just over my local network. Hosts file is not an option, sice most pcs are mobile and will access server both from within lan and over the internet.

The question is, are there routers capable of such redirection (low-cost, up to 50€) even if it means reflashing firmware with for example dd-wtr or is it posilble with local dns server? Or is there any completely different way?

enter image description here

Best Answer

The term you are looking for is split dns.

You run an internal DNS server which all LAN clients use. It has the same records as your normal external DNS server, but for local systems it has the LAN ip address instead of the public one.

The downside of split DNS is problems with mobile clients - some will cache the LAN ip address while on the internal wifi, and when they switch to a public internet connection still keep trying to use it. My new cell phone seems to clear it's DNS cache when it switches connections, so this seems to be less of an issue for newer devices.

The other option is to enable NAT loopback in your router. Some just enable this by default, others have an option for it. Some call it by a different name. But basically it makes your router recognise that requests for it's public IP shouldn't go out to the internet, but to a local server.

The downside of NAT loopback is that all the traffic flows through your router. In most cases, this isn't an issue. But depending on how your network is setup and how powerful your router is, it could potentially cause problems.

Related Topic