Raspberry pi: only ping able over IP

If I ping the hostname of my raspberry pi:

$ ping rpi3plus
ping: cannot resolve rpi3plus: Unknown host

over IP:

$ ping <IP>
PING <IP> (<IP>): 56 data bytes
64 bytes from <IP>: icmp_seq=0 ttl=64 time=0.819 ms
64 bytes from <IP>: icmp_seq=1 ttl=64 time=0.988 ms
64 bytes from <IP>: icmp_seq=2 ttl=64 time=1.376 ms
--- <IP> ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.819/1.061/1.376/0.233 ms
  Kernel: 6.1.37-1-MANJARO-ARM-RPI arch: aarch64 bits: 64 compiler: gcc
    v: 12.1.0 parameters: coherent_pool=1M 8250.nr_uarts=0
    snd_bcm2835.enable_headphones=0 snd_bcm2835.enable_headphones=1
    snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_hdmi=0
    video=Composite-1:720x480@60i vc_mem.mem_base=0x3ec00000
    vc_mem.mem_size=0x40000000 root=PARTUUID=9942a83b-02 rw rootwait
    console=ttyS0,115200 console=tty3 selinux=0 quiet splash
    plymouth.ignore-serial-consoles smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0
    kgdboc=ttyS0,115200 usbhid.mousepoll=8 audit=0
  Console: pty pts/0 Distro: Manjaro ARM base: Arch Linux
  Type: ARM System: Raspberry Pi 3 Model B Plus Rev 1.3 details: BCM2835
    rev: a020d3 serial: <filter>
  Info: model: N/A variant: cortex-a53 bits: 64 type: MCP arch: ARMv8 family: 8
    model-id: 0 stepping: 4
  Topology: cpus: 1x cores: 4 smt: N/A cache: L1: 256 KiB
    desc: d-4x32 KiB; i-4x32 KiB L2: 512 KiB desc: 1x512 KiB
  Speed (MHz): avg: 1400 min/max: 600/1400 scaling: driver: cpufreq-dt
    governor: schedutil cores: 1: 1400 2: 1400 3: 1400 4: 1400 bogomips: N/A
  Features: Use -f option to see features
  Type: itlb_multihit status: Not affected
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: mmio_stale_data status: Not affected
  Type: retbleed status: Not affected
  Type: spec_store_bypass status: Not affected
  Type: spectre_v1 mitigation: __user pointer sanitization
  Type: spectre_v2 status: Not affected
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
  Device-1: bcm2835-hdmi driver: vc4_hdmi v: N/A bus-ID: N/A
    chip-ID: brcm:3f902000 class-ID: hdmi
  Device-2: bcm2835-vc4 driver: vc4_drm v: N/A bus-ID: N/A chip-ID: brcm:soc
    class-ID: gpu
  Display: server: No display server data found. Headless machine?
    tty: 176x41
  API: N/A Message: No display API data available in console. Headless
  Device-1: bcm2835-hdmi driver: vc4_hdmi bus-ID: N/A chip-ID: brcm:3f902000
    class-ID: hdmi
  API: ALSA v: k6.1.37-1-MANJARO-ARM-RPI status: kernel-api tools: N/A
  Device-1: bcm2835-mmc driver: mmc_bcm2835 v: N/A port: N/A bus-ID: N/A
    chip-ID: brcm:3f300000 class-ID: mmcnr
  IF: wlan0 state: down mac: <filter>
  IF-ID-1: enu1u1u1 state: up speed: 1000 Mbps duplex: full mac: <filter>
  Device-1: pl011 driver: uart_pl011 bus-ID: N/A chip-ID: arm:3f201000
    class-ID: serial
  Report: rfkill ID: hci0 rfk-id: 0 state: down bt-service: not found
    rfk-block: hardware: no software: no address: see --recommends
  Device-2: pl011 driver: N/A bus-ID: N/A chip-ID: arm:serial0
    class-ID: serial
  Report: This feature requires one of these tools: hciconfig/bt-adapter
  Local Storage: total: 29.73 GiB used: 2.77 GiB (9.3%)
  SMART Message: Required tool smartctl not installed. Check --recommends
  ID-1: /dev/mmcblk0 maj-min: 179:0 vendor: SanDisk model: SD32G
    size: 29.73 GiB block-size: physical: 512 B logical: 512 B tech: SSD
    serial: <filter> scheme: MBR
  ID-1: / raw-size: 29.26 GiB size: 29.26 GiB (99.99%) used: 2.72 GiB (9.3%)
    fs: f2fs dev: /dev/mmcblk0p2 maj-min: 179:2
  ID-2: /boot raw-size: 457.8 MiB size: 457.5 MiB (99.94%)
    used: 54.6 MiB (11.9%) fs: vfat dev: /dev/mmcblk0p1 maj-min: 179:1
  Kernel: swappiness: 60 (default) cache-pressure: 80 (default 100)
  ID-1: swap-1 type: zram size: 1.33 GiB used: 0 KiB (0.0%) priority: 100
    dev: /dev/zram0
  Src: /sys System Temperatures: cpu: 55.3 C mobo: N/A
  Fan Speeds (RPM): N/A
  Processes: 136 Uptime: 7h 33m Memory: total: N/A available: 908.4 MiB
  used: 135.4 MiB (14.9%) igpu: 76 MiB Init: systemd v: 253 default: graphical
  tool: systemctl Compilers: gcc: 12.1.0 Packages: pm: pacman pkgs: 254
  libs: 56 tools: yay Shell: Zsh v: 5.9 running-in: pty pts/0 (SSH)
  inxi: 3.3.28

Add entry in /etc/hosts. Your machine will look there 1st:

the-ip-address      rpi3plus

Mine to get to machines on my network:       localhost localhost.localdomain    jellyfin     desktop     vim3     rock64     pbp

If I add this the ethernet Interface became down state

try: localhost localhost.localdomain rpi3plus

Not sure if you need the “localhost.localdomain”, ‘ localhost’ may be sufficient

I have run into that a few years back where if you put any entry in /etc/hosts you lose the network. It has been too long what really caused it but it seems like 2 different network mangers installed at the same time.

I use the minimal arm image.
I did not installed any additional network manger
Only dhcpcd
BTW, I have Pi-hole running as DHCP Server and DNS. On another raspberry pi.

I added the rpi3plus to my .ssh/config now.

if you use DNS and DHCP, did you configure them to assign hostnames, i.e., based on MAC address? If so, maybe remove the entry ‘rpi3lus’ entry from etc/hosts and leave the name management to DNS. Seems @Darksky has the right idea.

@hape do you mean Conditional forwarding it was not enabled.
But the issue is still present.

Depends, do you have a DNS Server that is not the main DNS Server for your Network that can resolve your hostname? Do you have a search domain for your Network?
You need to configure your DNS Server in your network, so it “know” the devices. This usually wont work out of the box. Specially if you use your own DHCP Server.

An alternative would be mDNS, but this needs Avahi on all Linux systems (and an open Port) and is not that fast. It uses “.local” as a domain. Do not use this domain as your normal home network domain. It is reserved for mDNS.

or I do have to use Network Manager instead of dhcpcd

The problem with a DNS lookup issues has nothing to do with the software use on your “raspberry pi”, but only with the DNS setup on the system you ran the ping commands and the DNS setup of your Network.

However, if you use dhcpcd as a DHCP client on your “raspberry pi”, make sure it sends the desired hostname with the DHCP queries. By default it is the hostname of the system.

To be able to ping using hostname - ths system’s hostname must be known on the network.

This is usually achieved using a DNS server but can also be achieved using mDNS or using the hosts file.

The simple method is to append ip and a hostname it to you workstations hosts

Avahi is such mDNS service - and it is installed on all Manjaro systems - albeit not enabled - as a dependency of Network Manager.

sudo systemctl enable avahi-daemon

Maybe not on Manjaro ARM minimal it’s using dhcpcd I will try your suggestion and switch to Network Manager.

Just install avahi on the rpi - then enable the avahi-daemon and the avahi-dnsconfd - same on your workstation

For unknown reasons my manjaro-arm minimal didn’t setup the hosts which may cause interference but using avahi I can ping it using the host name

 $ ping rpi
PING rpi ( 56(84) bytes of data.
64 bytes from rpi.local ( icmp_seq=1 ttl=64 time=0.222 ms
64 bytes from rpi.local ( icmp_seq=2 ttl=64 time=0.217 ms
64 bytes from rpi.local ( icmp_seq=3 ttl=64 time=0.223 ms
64 bytes from rpi.local ( icmp_seq=4 ttl=64 time=0.221 ms
64 bytes from rpi.local ( icmp_seq=5 ttl=64 time=0.281 ms
64 bytes from rpi.local ( icmp_seq=6 ttl=64 time=0.233 ms

If you are running an rpi on manjaro-arm minimal - then you would have setup a static ip - right?

Although it will work without - when you setup a such remote system - best practise is to remember populating the server’s /etc/hosts like

static ip localhost
ip.x.y.z your-host-name

dhcp locahost your-host-name
1 Like

@linux-aarhus ping rpi3plus does not work.
ping rpi3plus.local work.

My search domain is called lan.

hmm … I wanted to try a bare minimum - just as anyone would do so

My results may be due to my network setup - running ISC bind DNS service and ISC DHCP service on a RPI 3B on a FQDN net.nix.dk

  1. Download the latest minimal from web 22.03
  2. Write to sdcard
  3. Boot my pi4 8g
  4. ssh root@ip
  5. Complete oem setup
    • Naming the system rpi48
    • Opposed to the other card named rpi
  6. reboot
  7. Wait for the device to settle (forgot about it until I saw your response)
  8. Execute a ping
 $ ping rpi48
PING rpi48 ( 56(84) bytes of data.
64 bytes from rpi48 ( icmp_seq=1 ttl=64 time=0.221 ms
64 bytes from rpi48 ( icmp_seq=2 ttl=64 time=0.224 ms
64 bytes from rpi48 ( icmp_seq=3 ttl=64 time=0.213 ms
64 bytes from rpi48 ( icmp_seq=4 ttl=64 time=0.205 ms
64 bytes from rpi48 ( icmp_seq=5 ttl=64 time=0.193 ms
--- rpi48 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4049ms
rtt min/avg/max/mdev = 0.193/0.211/0.224/0.011 ms

On my workstation I have avahi-daemon and avahi-dnsconfd enabled and running.

The ip is the same as the other sdcard I tested - as it is dhcp assigned and the dhcp server remember the mac address

Logging onto the system I checked how IP is retrieved

[nix@rpi48 ~]$ systemctl status dhcpcd
● dhcpcd.service - dhcpcd on all interfaces
     Loaded: loaded (/usr/lib/systemd/system/dhcpcd.service; enabled; preset: disabled)
     Active: active (running) since Mon 2023-07-24 09:28:30 CEST; 1h 47min ago
    Process: 325 ExecStart=/usr/bin/dhcpcd -q -b (code=exited, status=0/SUCCESS)
   Main PID: 330 (dhcpcd)
      Tasks: 5 (limit: 4152)
        CPU: 231ms
     CGroup: /system.slice/dhcpcd.service
             ├─330 "dhcpcd: [manager] [ip4] [ip6]"
             ├─331 "dhcpcd: [privileged proxy]"
             ├─332 "dhcpcd: [network proxy]"
             ├─333 "dhcpcd: [control proxy]"
             └─455 "dhcpcd: [BPF ARP] end0"

Jul 24 09:28:34 rpi48 dhcpcd[331]: end0: IAID 01:a4:1a:9d
Jul 24 09:28:34 rpi48 dhcpcd[331]: end0: adding address fe80::3a7d:3d52:5063:f29a
Jul 24 09:28:35 rpi48 dhcpcd[331]: end0: soliciting an IPv6 router
Jul 24 09:28:35 rpi48 dhcpcd[331]: end0: soliciting a DHCP lease
Jul 24 09:28:40 rpi48 dhcpcd[331]: end0: offered from
Jul 24 09:28:41 rpi48 dhcpcd[331]: end0: probing address
Jul 24 09:28:45 rpi48 dhcpcd[331]: end0: leased for 77263 seconds
Jul 24 09:28:45 rpi48 dhcpcd[331]: end0: adding route to
Jul 24 09:28:45 rpi48 dhcpcd[331]: end0: adding default route via
Jul 24 09:28:47 rpi48 dhcpcd[331]: end0: no IPv6 Routers available

I should say that the client where I execute the ping is a Macbook.
Debian (Raspbian) ping works on the mb via ping hostname.
On ArchLinux ARM I do not have this issue, maybe config is different?
Otherwise it is a Pi-hole issue. IP of the Raspberry with manjaro has hostname “unknown”

Try enabling “Use Conditional Forwarding” under settings > DNS on your pihole (at the bottom of the page)

It’s enabled already.
BTW I can ping it on my Pi-Hole
so maybe a bug on macOS… not our problem.

I know that a lot of people has gotten used to various tools abstracting the intricasies of network but even those tools cannot find what is not configured correct.

But that does not make the command correct

ping rpi

whereas a FQDN is easily found

ping rpi.local

Perhaps - I can easily reproduce the issue using a macbook device.

But we are talking network configuration here so if one is not able to lookup a host - then - at some point - it is the configurattion which is at fault.

A properly configured hosts file is necessary if you want the device to be recognized by the network.

Using ping hostname is bound to give errors when the command requires a FQDN to be able to locate the host by traversing the name backwards e.g.

ping sql.net.nix.dk

but if there is no local authoritative nameserver for net.nix.dk if will end at nix.dk thus returning NXDOMAIN

You don’t have to use the big bind setup - as you could use unbound to run a few local-zone with a few hosts.

Avahi is authoritative for .local - but it needs to be configured.

fh@Root13 ~ % ping ns.net.nix.dk
PING ns.net.nix.dk ( 56 data bytes
64 bytes from icmp_seq=0 ttl=64 time=10.423 ms
64 bytes from icmp_seq=1 ttl=64 time=5.235 ms
64 bytes from icmp_seq=2 ttl=64 time=5.268 ms
64 bytes from icmp_seq=3 ttl=64 time=202.344 ms
64 bytes from icmp_seq=4 ttl=64 time=57.170 ms
--- ns.net.nix.dk ping statistics ---
5 packets transmitted, 5 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 5.235/56.088/202.344/75.691 ms
fh@Root13 ~ % dig rpi

; <<>> DiG 9.10.6 <<>> rpi
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 50324
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

; EDNS: version: 0, flags:; udp: 4096
;rpi.				IN	A

.			10757	IN	SOA	a.root-servers.net. nstld.verisign-grs.com. 2023072400 1800 900 604800 86400

;; Query time: 14 msec
;; WHEN: Mon Jul 24 15:36:27 CEST 2023
;; MSG SIZE  rcvd: 107

fh@Root13 ~ % dig rpi.net.nix.dk

; <<>> DiG 9.10.6 <<>> rpi.net.nix.dk
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 26097
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

; EDNS: version: 0, flags:; udp: 4096
;rpi.net.nix.dk.			IN	A

net.nix.dk.		3600	IN	SOA	ns.net.nix.dk. root.nix.dk. 2022040401 3600 3600 604800 10800

;; Query time: 12 msec
;; WHEN: Mon Jul 24 15:36:32 CEST 2023
;; MSG SIZE  rcvd: 87

fh@Root13 ~ % nslookup tiger

Name:	tiger.net.nix.dk

fh@Root13 ~ % nslookup rpi.net.nix.dk

** server can't find rpi.net.nix.dk: NXDOMAIN

fh@Root13 ~ % 
fh@Root13 ~ % nslookup rpi           

** server can't find rpi: NXDOMAIN