Cannot connect to machine on local network

I recently added a Raspberry Pi to my network, with the intention of using it as a basis for a printserver/fileserver in my home network. The Pi is running fine, so now I want to connect to it.

On my (Mac) laptop, the Pi was immediately accessible as raspberrypi.local, which was great.
On the family computer (running Tumbleweed), the Pi is only accessible through the IP address, but not through raspberrypi.local. I found several examples of this happening to other people using other distributions (for instance https://askubuntu.com/questions/1068131/ubuntu-18-04-local-domain-dns-lookup-not-working, https://unix.stackexchange.com/questions/457166/can-not-resolve-local-domains-internal-to-my-office-lan) but these didn’t help me resolve the issue - in part because the mdns services are different, or the suggested tools appear to be outdated.

What I know:

  1. It works on my laptop (and iPad), so it doesn’t appear to be an issue with either the Pi or the router.
  2. Connecting using the IP address works
  3. It doesn’t appear to be caused by the firewall (the problem persists if I disable the firewall)
  4. Faffing around with random suggestions to change things in /etc/systemd/resolved.conf and /etc/avahi/avahi-daemon.conf didn’t help (I reverted the changes back to the stock values)

So, I could use some help figuring out how to fix this. At the moment, I’m not sure where to look next and what to try next. Suggestions appreciated.

In the past, I just assigned a static IP to my fixed computer and added it to /etc/hosts. I could do that now too, but I would like something scalable that doesn’t require me to manually tweak /etc/hosts on every computer in the house - and I’d like to be able to troubleshoot and fix this if it comes up again in the future.

As you already understood, there must be something that resolves domain/hostnames to IP addresses (and v.v.). I have no idea what on your MAC does do this and where it got the information from. The clasical way is indeed putting it in /etc/hosts, or run a DNS server in your network.

An in between solution might be using NIS. Or rsync /etc/hosts from one system to all others.

That got me thinking.
I don’t know what service is running on my Mac that makes this work either (if I did it might be easy to find an equivalent, if not the same, service for Linux), but it has the IP address of my router listed as the first nameserver in /etc/resolv.conf (which is apparently generated from where the Mac actually stores its information). This suggests that the router itself is acting as a DNS server. Indeed, it is also listed as the first nameserver on the Linux box. However, trying to resolve the adres of the Pi gives


$ nslookup raspberrypi.local
;; Got recursion not available from 192.168.2.254, trying next server

which suggest that there is perhaps a difference in the way the Mac contacts the DNS server and the way the Linux machine does. Googling how to go about tweaking that so far hasn’t resulted in any clear answer though.

As an additional point of information that I failed to mention in my initial post: I set up the Pi as a CUPS server. It appears as a “Discovered network printer” when I go to http://localhost:631/admin on my Mac. It does not show up when I do the same on the Linux box, so clearly there is more to it not picking up “services” on the network than just the name.

I’ll keep trying to work out what’s going on here (if anyone has more pointers, that would be great), but I have a (convoluted?) idea for how to make it work: run a DNS server on the Pi, and then point the router to the Pi for DNS lookups (and make sure the Pi doesn’t ask the router again).

IMHO your router is just a forwarder of a DNS sever of your provider, which is part of the world wide DNS. There is no top level domain “local” in the DNS.

On my (Mac) laptop, the Pi was immediately accessible as raspberrypi.local, which was great.
On the family computer (running Tumbleweed), the Pi is only accessible through the IP address, but not through raspberrypi.local. I found several examples of this happening to other people using other distributions (for instance https://askubuntu.com/questions/1068…up-not-working, https://unix.stackexchange.com/quest…-my-office-lan) but these didn’t help me resolve the issue - in part because the mdns services are different, or the suggested tools appear to be outdated.

Hi eglebbk. You MAC is using Bonjour/Avahi (multicast DNS name resolution and DNS Service Discovery), which your Linux host should also be able to do. I use this in my home network for resolving local hostnames. However, if you have firewalld active this may prevent that from working. As such, you need to check that mdns is allowed. So check this first.

I don’t know Apple networking and only track what leaks into other discussions, but I do know that each OS implements a different set of “helper” services that can make a difference, for Apple it’s generally Bonjour and Zeroconf.

Linux is generally known for not supporting a standard set of services that are installed automatically, like many other things in Linux we are expected to install what we wish and be willing to learn how to do everything that’s necessary, A to Z. The most common system we set up is Avahi.

But otherwise,
There is the basic nuts and bolts of IP addressing and name resolution before you might start to consider helper services…
If you simply set up what is most basically necessary, helper services are even unnecessary.

Nowadays,
The specific type of name resolution that is set up universally is the Hostname naming system, and is largely because that is how the Internet is set up.
If you set up your LAN name resolution the same way, then you don’t need to maintain different systems and everything will work the same way.

You can look up numerous guides and articles that describe the Hostname naming system, but the following is typically the order how names are looked up, so you can modify any of the following to successfully make name resolution on your LAN work…

**/etc/hosts ** This file is the ultimate repository for mapping names to IP addresses, and can be used to over-ride other mappings
dns resolver This is often set up on the client machine itself, and there are tiny multi-function apps like dnsmasq.
**DNS server ** At least, an authoritative DNS server which means it holds mappings specific to your LAN. The more common DNS Server you might see on your Internet Gateway router is more likely a Forwarding DNS server which means that it doesn’t hold special mappings but is simply an accessible server that can forward queries to another upstream server which might have the name mapping you’re looking for. If you wish, and know how you can set up an authoritative DNS server on your LAN.

Unlike other OS, Linux is particularly well known for <not> sending out repeated broadcasts (attempts to communicate with other machines without knowing their addresses), so compared to other OS, you may need to configure one of the above to support name resolution in your network.

HTH,
TSU

As I already mentioned, it is Avahi, and it should be active already…but easy enough to check with

sudo systemctl status avahi-daemon

It is likely to be a firewall issue blocking the multicast traffic. Check

sudo systemctl status firewalld

and if active, check

firewall-cmd --list-all

Make sure that mdns is allowed. Adjust the firewall as necessary.

Aaaaand it works! :slight_smile:

It turns out that, contrary to what I suspected, it was the firewall blocking mDNS. Apparently when I disabled the firewall earlier, I didn’t actually disable it (?). I also thought that mDNS had been added to the list of available services, but I guess I put it in the wrong “zone” (which, admittedly, I don’t fully understand what those are yet).

So adding mDNS to the allowed services on the firewall made everything work: the computer resolves raspberrypi.local, the printer shows up in the list of CUPS printers. It’s all good. Thanks a bunch for pointing me in the right direction!

Tinkering around with figuring out what services are running and active did make me realise that I need to read up on how systemd works. Back when the transition from System V-style init to systemd was happening I didn’t pay much attention to it (and resisted the change for a couple of years) and when I installed the newer system from scratch it wasn’t on my radar as something I needed to be aware of. So I guess I’ll be looking into that next (my impression is that I don’t like it much so far, but I understand this is a somewhat controversial topic).

Anyway, thanks again for the help everyone!

Glad to have been of guidance. It catches a lot of users out. :slight_smile:

Tinkering around with figuring out what services are running and active did make me realise that I need to read up on how systemd works. Back when the transition from System V-style init to systemd was happening I didn’t pay much attention to it (and resisted the change for a couple of years) and when I installed the newer system from scratch it wasn’t on my radar as something I needed to be aware of. So I guess I’ll be looking into that next (my impression is that I don’t like it much so far, but I understand this is a somewhat controversial topic).

Anyway, thanks again for the help everyone!

It takes a bit of getting used to, but actually I think it is cleaner and more structured. I don’t buy the argument that some users say it is less configurable and complicated. If you need help with getting to grips with it post again, and I’m sure we can explain or provide guidance.

Some reading to get you started:
https://doc.opensuse.org/documentation/leap/reference/html/book.opensuse.reference/cha-systemd.html