Should I use FQDN or hostname only in OpenWrt

My network has an internally-visible-only dns schema and dns server. I have unique hostnames defined in forward and reverse dns for each of my openwrt hosts.

Should I enter the FQDN or just the hostname part in the 'Hostname' field below?:

What is the practical difference?
What difference does it make to the operation of OpenWRT?

Regarding the display name/hostname (which seems like your intention), that should be the device hostname, not FQDN.

To setup a known domain in OpenWrt or a DNS server exclusive for it, you'd set that under Network > DHCP and DNS:

screen103

Then, you would just add the Internal DNS server as the WAN/upstream DNS servers.

1 Like

I thought that page Network > DHCP and DNS had to do with dhcp and dns service provided by the wrt to other network hosts, not the configuration of the wrt itself.

My OpenWRT devices don't have that page at all. Mine are wireless AP bridges, so I don't want them providing dhcp or dns themselves. My openwrt devices are dhcp clients, and typically on my lan, dhcp gives out devices their hostname and domain name

Ok, then hostname is fine. You will have to add it to your DNS server if you want it to resolve, then.

So you're saying the usage of the hostname field in System -> System depends on wether you're running dnsmasq and doing NAT? If so, then just the single name (no periods) and if not then the fully qualified domain name?

Does your AP uses DHCP from your router and your DHCP server handles domain names for clients? If yes your AP needs to know only it's hostname not the fqdn.

My dumb APs using DHCP to get a management IP and have only a hostname configured and via DNS I can access them via their fqdn. I have a dedicated domain per vlan on my setup.

My AP uses dhcp from my dhcp server. My DNS server handles domain names for clients.

It does so happen that the dhcp server and dns server run on the same host which performs NAT routing between the LAN and internet. That host is in an equipment room not suited for wireless signals, and so that host has no radio antennas.

One might call my APs "dumb" as well. Their only function is bridging copper ethernet to their onboard radios, and the web/cli interface gets used to see what is connected to what when I need to troubleshoot something. I don't want my APs performing any L3, L4, or more advanced services.

I kind of want to suggest that the hostname field i referred to have a note by it to explain when to use fqdn and when not. Or have a seperate field for hostname and domain name, with a checkbox to grey them both out and 'use values from dhcp'. But maybe that's 'too complicated for the common user'..... But then again, "the common user" probably doesn't know what firmware is, let alone isn't going to re-flash their router to openwrt.

No...I'm saying that:

  • if you want to change the name of the router from "OpenWrt" - change the hostname to "AP2"
  • if you want it to resolve on your network, add ap2.example.com to your DNS server - that's not OpenWrt-related since I understand it's not this device and the device you're using for DNS isn't OpenWrt (we wouldn't know how this works, and all DNS servers don't do combined DHCP)
  • I know if you setup a domain in an OpenWrt (e.g. .lan) - then all hostnames are appended if the OpenWrt is the DNS and DHCP server (i.e. dnsmasq). I cannot answer for some other device.
  • the automatic add of hostnames works on OpenWrt if you get your IP via DHCP, I surmise that the AP has a static address - so I considered that in my response, as I don't know your DHCP/DNS server :bulb:
  • I have no clue why you mentioned NAT, a DNS query gets an A or AAAA as response, NAT doesn't matter, the correct answer does (let me know if I missed something)

If you want to add a FQDN, that's fine. I originally thought your goal was to have this name resolve on your network. My bad if that's not the case. At any rate, OpenWrt or not, placing a FQDN on a device but not configuring it in a DNS server confuses me.

Me too. Who said they were not configuring it in dns?

I wasn't asking for advice setting up a home network. I was asking about how OpenWRT uses that field, and what it is for.

What difference does it make to the OpenWRT operating system. I was trying not to just get an echo of my own presumptions, but For example, could I use an ntp server by its internal hostname of just 'ntp' if the openwrt was aware that its domain was internal.mydomain.com and it would append the domain name to the hostname to resolve ntp.internal.mydomain.com.

How do you configure the openwrt's domainpart at all, if you don't put it in the hostname field. I don't see a place to put the domainpart (outside of configuring an onboard dns/dhcp server which I don't have or need)

1 Like

It has the same affect of setting the hostname in any Linux system:

https://manpages.courier-mta.org/htmlman7/hostname.7.html

You can use ntp if you:

  • used OpenWrt as your DNS
  • assigned ntp it
    • via hostname of the device (in OpenWrt)
    • DHCP obtained IP and host gave hostname to dnsmasq in OpenWrt
    • or Static and you made a record in the dnsmasq of OpenWrt
  • did not set a trailing domain

Again:

screen103

The local domain portion is what you use - e.g the default is lan, so ntp.lan would work and looking up lan should append .lan if need be.

(You keep asking about OpenWrt, but my apologies, I was confused because I understood you to say that you weren't using it as your DNS - but not I understand you're just inquiring.)

You may want to look at the dnsmasq manual for more information, it's not a full DNS server, just a "resolver". :bulb:

That's why you add a record for any host to your own DNS server - either manually, DHCP notification, etc. - this is normal. :wink:

If you are actually trying to add to your device to the DNS network using a non-OpenWrt DNS server that is - and not merely inquiring. Treat it like any other network host. If it's not behaving like one you're used to with DNS, let us know.

:spiral_notepad: Also, I think you're mixing the Linux hostname setting and dnsmasq configs that will result in the desired DNS queries/resolution if you use the dnsmasq instance for DNS. They're not the same. You can remove dnsmasq (or use an image without it) if it's a bother or confusing, or just in your case don't need it whatsoever.