0

I have an web server running apache web server in my home network. My router unfortunately does not allow NAT loopback, so testing my own projects, or accessing other self-hosted services (owncloud, seafile,etc) can only by done using my internal server IP while I am connected to my LAN, and using my DNS domain outside my LAN. Obviously this back and forth is not ideal.

After considering the possible solutions, I came to the conclusion that least painful way to resolve DNS domains that point to my internal IP is to host my own DNS server and configuring my router to use my local DNS server. dnsmasq seems like a good choice for this.

However, as I was about to install dnsmasq in the same server that is running apache, docker, among other services, I was wondering what would be the least intrusive way to configure dnsmasq so it doesn't accidentally break other services already running in my local server. In addition, I was wondering if dnsmasq will allow the server (localhost) to access a DNS domain that redirects backs to itself, given that I will likely have to map a public address to its internal IP so it can be properly accessed by any device connected to my lan (example.com --> [IP of local server in LAN] and not example.com --> 127.0.0.1). Is there a way to resolve this issue in dnsmasq, so that all the LAN devices, including the local server, can access the same site using a public address?

UPDATE #1

Before installation, running: sudo nmap -sn 192.168.10.0/24 to see the IPs of my LAN devices will return a line containing the nickname of my server (I am not sure who assigns the nickname, maybe the router?) and its IP as follows: Nmap scan report for myserver.lan (192.168.10.130)

However, after installing dnsmasq and using it as my default DNS server in my router config, the nickname for my server is gone. If I do sudo nmap -sn 192.168.10.0/24 it will return a line containing Nmap scan report for 192.168.10.130. If I try to access my server from a different computer in my LAN as I used to do before dnsmasq, by typing myserver.lan, is not longer redirecting to my local server.

3
  • I think its a matter of "suck it and see". I would not expect DNSMasq to break Apache or most other services (I've never seen it cause issues of this kind). It is unclear what you mean by DNSMasq to allow access to a DNS domain that redirects back to itself. DNMasq would typically have IP address entries coded for the domain, or read these from the hosts file. DNSMasq, when run as both an authorative and recursive server will answer authoratively for names it thinks it knows, and forward other requests on. I wonder if you are overthinking this.
    – davidgo
    Commented Nov 24, 2021 at 5:03
  • Thanks David. I might be overthinking this a bit, I just wanted to avoid disrupting several other services in my server. As for your q, the IP address coded in dnsmasq for the domain will be the LAN address for the local server (eg 192.160.40.100) instead of its self address (127.0.0.1) so that it can be access by my LAN devices. I was wondering if this setup will still allow me to "access" the domain from the same local server that it is hosting it, Hopefully that makes sense. Commented Nov 24, 2021 at 5:11
  • You will just want to make sure that your services are listening on all ports - this would be true for Apache already if you can get answers from other devices on your network.
    – davidgo
    Commented Nov 24, 2021 at 5:13

0

You must log in to answer this question.

Browse other questions tagged .