2023-11-22 Scanning the local network

I have a very old Raspberry Pi 0 that runs a music daemon. Today my client couldn't connect to it. And neither can I connect using SSH.

alex@melanobombus ~> ssh raspberrypi 
ssh: Could not resolve hostname raspberrypi.local: Name or service not known

"raspberrypi" is defined in my config file, `~/.ssh/config`:

Host raspberrypi
  HostName raspberrypi.local
  User root

Since the music is still playing, I know the machine is up. It's just the name that doesn't work.

So now I wanted to know: what machines are there on my local area network right now?

Based on Display list of computers on a LAN in Linux, I ran `ifconfig`:

Display list of computers on a LAN in Linux

alex@melanobombus ~> ifconfig
…
wlp1s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.178.48  netmask 255.255.255.0  broadcast 192.168.178.255
…

(I ran `iwconfig` to confirm that this is my wireless interface.)

The important part is the IP Number and the netmask. The output above basically means that my network uses the numbers 192.168.178.0 to 192.168.178.255. Or in CIDR notation: 192.168.178.0/24.

As a note to my future self: CIDR notation indicates the number of bits set in the netmask. There are four bytes in the netmask, each having 8 bits. The first three bytes of the netmask listed are 255, so there are three bytes with all bits set. The last byte is 0, so no bits are set. Thus, the first 3×8=24 bits are set, explaining the `/24` part. The part in front of the slash are the remaining bytes. In this case three bytes with all bits set means that I can use the three bytes of my own address: 192.168.178.48 → 192.168.178.0.

So now I'm ready to run `nmap`:

alex@melanobombus ~> sudo nmap -sP 192.168.178.0/24
Starting Nmap 7.93 ( https://nmap.org ) at 2023-11-22 10:33 CET
Nmap scan report for fritz.box (192.168.178.1)
Host is up (0.0033s latency).
MAC Address: 38:10:D5:5D:4D:D1 (AVM Audiovisuelles Marketing und Computersysteme GmbH)
Nmap scan report for Nerd-Cave.fritz.box (192.168.178.26)
Host is up (0.041s latency).
MAC Address: C4:67:B5:08:42:2E (Libratone A/S)
Nmap scan report for Thoracobombus.fritz.box (192.168.178.34)
Host is up (0.037s latency).
MAC Address: 62:7D:AE:7F:D7:19 (Unknown)
Nmap scan report for melanobombus.fritz.box (192.168.178.48)
Host is up.
Nmap done: 256 IP addresses (4 hosts up) scanned in 2.75 seconds

So… which one is it? `.1` is the router. `.26` is the speaker playing the music (the wireless network is useless since it's getting the audio signal via a cable from the Raspberry Pi). `.34` is the iPad. `.48` is the laptop, as we established at the very beginning.

In short, it seems as if the Raspberry Pi is no longer online. 💩

Perhaps I should switch it out for the Raspberry 4 one of these days.

Then again, let's see what the router says? Using the web interface:

+-------------------+------------+----------------+---------------------------+
|       Name        | Connection |   IP address   |        Properties         |
+-------------------+------------+----------------+---------------------------+
| PC-192-168-179-29 | WLAN       | 192.168.179.29 | 5 GHz, 650 / 650 Mbit/s   |
| melanobombus      | WLAN       | 192.168.178.48 | 2,4 GHz, 280 / 300 Mbit/s |
| raspberrypi       | WLAN       | 192.168.178.47 | 2,4 GHz, 72 / 29 Mbit/s   |
| Nerd Cave         | WLAN       | 192.168.178.26 | 2,4 GHz, 53 / 39 Mbit/s   |
| Thoracobombus     | WLAN       | 192.168.178.34 | 5 GHz, 780 / 702 Mbit/s   |
+-------------------+------------+----------------+---------------------------+

Uhm, hello `.47`??

alex@melanobombus ~> ping 192.168.178.47
PING 192.168.178.47 (192.168.178.47) 56(84) bytes of data.
From 192.168.178.48 icmp_seq=1 Destination Host Unreachable
From 192.168.178.48 icmp_seq=2 Destination Host Unreachable
From 192.168.178.48 icmp_seq=3 Destination Host Unreachable
^C
--- 192.168.178.47 ping statistics ---
6 packets transmitted, 0 received, +3 errors, 100% packet loss, time 5097ms

I guess the network is down one way or another.

Time to pull the cable. 😞

​#Administration