Local DNS (w or w/o DHCP?)

Hi there!

I'm very very new to LEDE !
I just received a BT homehub5, setup with LEDE.
I do not intend to use it as modem or router, just as dummy wifi AP + ethernet switch.

But while looking around in the options, I have seen "DNSmasq".

I was wondering if I could use it has a kind of local DNS.
let me explain:
for example, if I have a NAS at ip 192.168.1.63 and I want to call this NAS "robert"
Then, I would like that if I type "http://robert" on any computer in my home, I shall go to http://192.168.1.63. Is this possible? if yes, how can I do ? :slight_smile:

So far, I use the DHCP from my ISP box, but I could use the DHCP from LEDE instead (if necessary for this DNS idea).

Best regards,

1 Like

If you configure OpenWrt/LEDE via web Interface, go to Network -> Hostnames and enter the desired hostname+adress there.

You can keep your curent DHCP server if you want to, just ensure that the DHCP clients receive the IP-adress of your LEDE box as DNS server

Ok, so:

  • I keep my DHCP, but replace my current DNS settings (in DHCP) with my LEDE ip address. Then, computers will 1st go through LEDE to find any local address.
  • I set in hostname any name I would like to give to my NAS, servers etc...
  • I guess I shall maybe set in LEDE the external DNS server for everything that is not on my LAN? (I mean the internet DNS, like openDNS or google DNS or whatever ?)
    shall I use this "DNS forwarding" section in "DHCP and DNS" ?
    This "DHCP and DNS" section is a bit confusing to me if I use only the DNS part and not DHCP.

Yes, you can use the DNS server provided by your ISP, or use a public one.

Hi!
I set a couple of hostsnames and their matching ip address.
I set my computer to use my lede device as dns (192.168.1.252).
But it seems not enough to make that I can use the hostname in my browser instead of ip.

Did I missed something?

You should check if your DNS settings are correct, what's the output of dig robert compared to running it with explicitly set DNS server like dig robert @192.168.1.252 ? Also compare the output, when checking for a domain like openwrt.org.

Hi ! I double check my config, and also last week I had to reset completely my config, so I'm not sure if I did something wrong before, but now it's working !!

I did the following:

  • defined some hosts in LEDE luci : networks/hostnames
  • in networks / DHCP and DNS, I added a few DNS servers in "DNS forwarding" section.

on my computer:
I defined as DNS server (static), le IP address of my LEDE device (LAN address).

and now I can ping or navigate using fancy names defined in hostsnames list instead of IP address !!

:sunny: :sunny::sunny::sunny: :smile:

1 Like

What happens when the DHCP server changes the Device IP assignment, like when it reboots? Does the DNS server pick up the new IP automatically or do you have to bind the IP address to a MAC address on your Home LAN?

I cannot answer for sure of it's needed or not , but I do have ip matching with mac (mainly because I find it more convenient as I can remember a few ip by heart).

How/why would a static IP assignment change by itself?

1 Like

DHCP server can assign the same device a different IP address when the device is restarted, it a dynamic host configuration protocol. Typically it will use the same IP but not always.

All non-persistent settings are lost upon reboot as they are stored in memory/tmpfs.

  • Wired clients may not even try to reconnect and DHCP/DNS server will know nothing about them until the current lease expires or they reboot/reconnect.
  • Wireless clients should reconnect and DHCP/DNS server will obtain new data.

Sorry, I think my question was unclear. I meant to ask how the DNS server when running on a different device from the DHCP server gets updated Dynamic IP address information when either if these devices reboots and loses its non-persistent settings. I assume both DNS and DHCP servers have static IP addresses.

DHCP and DNS services don't interact if they run on different hosts, so you need to configure them separately.
If you want them to interact, it would require some scripting skills:
https://wiki.samba.org/index.php/Configure_DHCP_to_update_DNS_records_with_BIND9

1 Like

I was going to install OpenWRT on an old router or buy a cheap ‘travel’ router with it pre-installed and use it as my local/home DNS server. My thought was to disable DHCP on my router and have the OpenWRT device do the DHCP as well. Would you foresee any issues with this setup?