I've got a Nas doing DHCP and DNS ip adress =

local names are correctly resolved when raspberrypi-0-w ip is set to dynamic

pi@raspberrypi0-w2:~ $ ping munin
PING munin.cesan.lan ( 56(84) bytes of data.
64 bytes from ( icmp_seq=1 ttl=64 time=5.07 ms

After setting static ip in /etc/dhcpcd.conf, adress is outside dhcp range

# Inform the DHCP server of our hostname for DDNS.
# Use the hardware address of the interface for the Client ID.
# Persist interface configuration when dhcpcd exits.
# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit
# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu
# A ServerID is required by RFC2131.
require dhcp_server_identifier
# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private
# Static IP configuration:
interface wlan0
static ip_address=
static routers=
static domain_name_servers=

after reboot:

pi@raspberrypi0-w2:~ $ ping munin
ping: munin: Nom ou service inconnu

local host is unknown

If I ping with adress it's ok

pi@raspberrypi0-w2:~ $ ping
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=64 time=2.48 ms

if I ping outside LAN it seems to resolve the name but I don't get the ping

pi@raspberrypi0-w2:~ $ ping raspberrypi.stackexchange.com
PING raspberrypi.stackexchange.com ( 56(84) bytes of data.

Is it a problem on Raspbian side or on the DNS side?

cat /etc/resolv.conf

# Generated by resolvconf
  • may i see your output of 'cat /etc/resolv.conf' Sep 27, 2017 at 21:02
  • # Generated by resolvconf nameserver
    – Penbeuz
    Sep 27, 2017 at 21:03
  • Do you have an entry in your /etc/hosts file such as : munin Sep 27, 2017 at 21:20
  • no, just standard hosts file
    – Penbeuz
    Sep 27, 2017 at 21:25
  • 1
    You should set static domain_search=.local to use non-fqdn based lookups, generally speaking this is specific to your router but .local is common (sometimes .home or something, it should be in router settings). You may also need to set domain_name=.local as well but search should be sufficient
    – crasic
    Sep 28, 2017 at 0:57

1 Answer 1

  • Add the host IP to the local hosts file


  • Set the DNS Search domain in dhcpcd.conf

    static domain_search=.local

If you want the inverse of this (ping pi based on hostname only) You may also need to add

  • static domain_name=.local or hostname_short

DNS Lookups require a Fully Qualified Domain Name (FQDN), e.g. abc.com

When you do a simple name lookup e.g. ping abc, unless the name is defined in the hosts file, it will not resolved. However, the setting domain_search ` adds one (or more) default domains to append to the dns lookup.

Your router will usually have a default domain, for example .local, but this may be different so look at the configurations

  • Doesn't seem to change anything for me. I will stick to dhcp with some scripts on my NAS to make DHCP know to DNS which machine is connected.
    – Penbeuz
    Sep 28, 2017 at 11:03
  • I've been running a DNS server on my NAS for months and have very little in my hosts file, certainly not all the computers in my little corner of the internet. And I don't have any problem in lookups, even when I add a new computer.
    – NomadMaker
    Jul 16, 2018 at 0:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.