-1

Is it possible to resolve a public domain (ex: http://example.com/ ) in local network ?

The local network has a server which hosted a website with domain http://example.com/. The local network is connected to internet

If I enter http://example.com/ from browser, then the request should go to local DNS and fetch my web page from my server instead of public DNS and fetch public website

krishna
  • 9
  • 1
  • did you ever heard about the hosts file? – djdomi Oct 09 '21 at 11:13
  • Nothing to do you running your own DNS server (e.g. dnsmasq) – hardillb Oct 09 '21 at 11:43
  • Add the following host entries to your host file and you will be able to run it in your local system. A - IP address where website actually pointing – Hiren Parghi Oct 09 '21 at 15:35
  • Ya, I configured dnsmasq as local dns and hosts files, but from devices the clients hitting public domain instead of local domain. some clients devices hitting local domain – krishna Oct 11 '21 at 05:03

1 Answers1

2

Usually every decently configured network has its own DNS server, which handles all of the DNS queried for attached subnet. You should configure this zone there.

So - yup, thats a common practice.

drookie
  • 8,625
  • 1
  • 19
  • 29
  • hi @drookie , I already configured, but the system has internet connection, so it is hitting public domain, when internet removed then it is hitting local domain. I want to hit always local domain irrespective of internet connection – krishna Oct 12 '21 at 07:28
  • The trick is simple - your in-LAN machnes have to have the internal DNS as their only resolver. And this internal DNS should resolve internal resources to the internal IPs. – drookie Oct 12 '21 at 13:47
  • Ya @drookie, your are right but when I connected to Internet then its hitting public domain. I want to use private domain which already exists in public. Without internet connection its working fine, but I want along with Internet connection – krishna Nov 10 '21 at 12:27