The Scanner That Couldn't See the Server
This is an AI generated article. I basically did zip/zero to solve this problem. I keep it here for future reference, when my EPSON Network scanner doesn't want to connect to my paperless setup again.
A tale of one ethernet jack, some dead-end mDNS theories, and why foo.local names are weirder than they look.
TL;DR: Our network scanner couldn't find the file server by its usual address. After chasing Docker, the firewall, Samba, Avahi and a chat app through the woods, the answer was embarrassingly physical: the server's network cable had been moved to a second ethernet port. Different port, different MAC address, so the DHCP reservation no longer matched, so the server lost its usual IP — and the scanner spent all day politely knocking on the old one.
The symptom #
The setup: a small Linux box ("peschel") running a Paperless document setup in Docker, which also exports a couple of folders over SMB. An EPSON network scanner is configured to drop scans into \\peschel.local\scan.
One day the scanner just… stopped seeing the server. Everything else worked. Only the scanner was unhappy.
Step 1 — Rule out "the service is down" #
Before blaming anything mysterious, ask the boring question: can another machine on the LAN actually reach the service?
From a second box on the same network:
1nc -zv 192.168.2.11 445 # SMB
2nc -zv 192.168.2.11 139 # SMB (legacy)
3ping -c2 192.168.2.11
All open, all answering. So the SMB server was fine and reachable, which quietly rules out a fat chunk of the usual suspects:
- Docker port publishing? No — the container runs on the host network, ports were open from outside.
- Firewall? No — an outside host connected fine.
- Samba config? No — shares listed and authenticated.
So it wasn't "the server is broken". It was "the scanner and the server disagree about something".
The mDNS rabbit hole (and why *.local is fragile) #
Our first instinct — and where we spent the most time — was that this was an mDNS problem, long before the wire straightened us out. That's partly because .local names really do fail in ways that look identical to "the network is broken", so it's worth writing down what we learned here; it'll come up again.
What's actually going on #
peschel.local isn't DNS — it's mDNS (multicast DNS, RFC 6762), a little peer-to-peer naming system where every machine answers for its own name, no central server involved. It's paired with DNS-SD (RFC 6763), which is the half that publishes services like printers and scanners.
- IPv4 group:
224.0.0.251, port5353 - IPv6 group:
ff02::fb - Both are UDP only — there's no TCP fallback, which matters later.
- On Linux the daemon that speaks this is Avahi (a normal system service,
systemctl status avahi-daemon).
It's also not one flat lookup. A hostname and a service are each published as a small graph of DNS records:
| Record | Question it answers |
|---|---|
A / AAAA |
"what IPv4 / IPv6 address does this hostname have?" |
PTR |
"what services exist of this type?" (also the reverse-name pointer) |
SRV |
"which host, and which port, does this service run on?" |
TXT |
"what extra key=value metadata does it carry?" |
So when the scanner is found, the answer is really "here's an SRV pointing at EPSONF931CE.local:443, plus a TXT blob describing model, duplex and colour" — the friendly list of scanners is just those records rendered.
Two facts cause most of the pain, and both come from "it's just UDP on a shared multicast group":
- Any process can grab port 5353. UDP ports have no per-process ownership; a program can
bind()5353and join the multicast group next to everybody else. - Responders often only answer queries that come from source port 5353. Per the RFC, a query from any other source port is a "one-shot" and may be answered differently — or ignored. That's why a would-be responder is forced to bind 5353 in the first place: it's the only port that reliably gets an answer.
How to probe mDNS #
1# What does this name resolve to, right now? (IPv4 only — add -6, or omit for both)
2avahi-resolve -n -4 peschel.local
3
4# Browse everything advertised on the LAN (-t = terminate once done)
5avahi-browse -a -t
6
7# Browse *one* service type and print its full records (SRV/TXT/address)
8avahi-browse -rt _uscans._tcp
9
10# Who currently owns the mDNS port?
11sudo ss -ulnp | grep 5353
12
13# Watch the actual conversation on the wire
14sudo tcpdump -i enp71s0 -n udp port 5353
That last one is the ground truth. Everything else is a tidy view of the same packets — including the ones being silently dropped.
The Chromium squat: two mDNS stacks on one port #
We didn't just suspect a second responder — we caught it. Restarting Avahi printed:
Detected another IPv4 mDNS stack running on this host
and ss -ulnp | grep 5353 named the culprit: a chat app (Electron — i.e. bundled Chromium) holding 224.0.0.251:5353 with four sockets, right alongside Avahi's 0.0.0.0:5353. Why is that even possible?
- UDP binds aren't exclusive.
SO_REUSEADDR/SO_REUSEPORTlet multiple sockets share anaddr:port, and two sockets bound to different local addresses (0.0.0.0vs the multicast224.0.0.251) both succeed. Nothing in the kernel says "one mDNS responder per machine." - Chromium is architecturally pushed onto 5353. Its media-router / Cast discovery wants to find and be found, and — per fact 2 above — the only way to get an answer is to send from port 5353. So it binds the same shared socket Avahi uses.
- The result is intermittent, not total. With multiple matching sockets, an arriving multicast can be delivered to either, so sometimes Avahi sees the query and answers and sometimes it vanishes. That's the classic "worked yesterday, flaky today" signature.
- Avahi expects it. There's a config knob literally called
disallow-other-stacks— "refuse to start if another mDNS stack is present." The fact that the option exists is the tell that this collision is a known, anticipated wart.
Chromium should detect an existing system responder over D-Bus and reuse it; Electron builds frequently ship without that integration. You can suppress the behavior per-app with a --disable-features=MediaRouter flag, but it's worth internalizing that this is a long-standing Chromium-vs-Avahi crowd, not something you broke.
The uncomfortable summary: a chat client can legitimately sit on the same UDP port as your system naming service. "System service" reserves the logic and the config file — not the port.
Why the hostname advertised itself five times (the Docker angle) #
The box runs a Paperless stack under Docker. Docker doesn't keep to itself — it creates a virtual bridge interface on the host for every network it needs:
docker0for the default network,- one
br-<hash>per Compose project (paperless-ngx_default,paperless-personal_default, …), - plus
virbr0from libvirt andvnet*from VM taps.
Each of those bridges gets a host-side gateway address — 172.17.0.1, 172.18.0.1, 192.168.122.1, and so on. And here's the kicker: they're ordinary interfaces as far as Avahi is concerned. Its default is to publish the hostname on every interface it can see, so peschel.local suddenly came back with several answers:
$ avahi-resolve -n -4 peschel.local
peschel.local 172.17.0.1 # ← Docker bridge, unreachable from the LAN (plus 4 more)
A client that grabs the first answer resolves peschel.local to a 172.x address that means nothing outside the host, and then "can't connect". Nothing is actually broken — the name just points at the wrong place.
Two details specific to our setup:
- The Samba container runs with
network_mode: host, which is why the SMB ports are the host's ports (139/445). It also means the host's Avahi does all the advertising — the container just rides along. - Docker advertises services too, not only addresses. Anything running an mDNS responder inside a container can show up on the LAN. Ours mainly leaked bridge addresses (plus a
_nut._tcpUPS record that lives on the host).
You can see the roster the way Avahi sees it, and correlate it with Docker's own view:
1ip -br addr # every interface + its addresses
2docker network ls # one network per br-<hash> above
3avahi-browse -art | grep -E 'docker0|br-[0-9a-f]+|virbr0|vnet[0-9]+'
Worth noting the leak grows on its own: each docker compose up that (re)creates a network mints a fresh br-<hash> with a fresh 172.x.0.1 gateway, and Avahi dutifully starts advertising the hostname on it too. That's why "it used to be fine" — there are simply more bridges than there used to be.
How to stop it #
Tell Avahi to only serve the interfaces you actually care about:
1# /etc/avahi/avahi-daemon.conf
2[server]
3allow-interfaces=enp71s0,enp69s0
then:
1sudo systemctl restart avahi-daemon
2avahi-resolve -n -4 peschel.local # back to exactly one, correct address
Prefer allow-interfaces= over deny-interfaces=. A deny-list looks tempting (deny-interfaces=docker0,virbr0,…) but the br-<hash> names change every time a Compose network is recreated, so the list quietly rots. Allow-listing your real NICs is stable.
Confirm it took with the same avahi-browse -art | grep … query from above — no output means nothing virtual is being advertised any more. You can also watch Avahi pick its interfaces as it starts:
1journalctl -u avahi-daemon --since "1 min ago" | grep -E 'Joining mDNS|New relevant'
2# should list only enp71s0 / enp69s0, never docker0 / br-* / virbr0
(Heads-up: an avahi package upgrade can reset that config file — if .local ever resolves to a 172.x again, check this line first.)
Why it's a system service (and why .local is a special zone) #
Avahi owns the host's identity, so it's naturally one process for the whole box rather than one per user — and it also becomes the thing every program resolves through. That second part happens via NSS: /etc/nsswitch.conf carries a hosts: line like
hosts: files mdns4_minimal [NOTFOUND=return] dns
which means a plain getent hosts peschel.local — or any ping/browser — routes .local lookups through the libnss-mdns bridge, which then asks Avahi over D-Bus. That's why the system knows the name even though no DNS server does:
1getent hosts peschel.local # goes through NSS → libnss-mdns → Avahi
Two more wrinkles worth knowing:
.localis reserved for mDNS. RFC 6762 sets that TLD aside precisely so it can't collide with global DNS — a real DNS zone should never define.local. It's an easy footgun, becausesystemd-resolvedand others can also be told to do mDNS, giving you two resolution paths that don't know about each other.- Names are defended by probing. Before claiming a name, an mDNS host asks "is anyone already using this?" and backs off if someone objects (RFC 6762 §8). That's why two machines publishing the same name cause confusing, intermittent behaviour instead of a clean error.
Probing from a second host #
Half of "proving" a network problem is doing it from somewhere else. Borrowing a second machine:
1nc -zv <target-ip> 445 # is the port reachable at all?
2ping -c2 <target-ip>
3sudo tcpdump -i eth0 -n udp port 5353 # what's actually on the wire?
If a raw multicast listener sees nothing, remember two gotchas: you must join the multicast group to receive, and on multi-homed boxes the kernel loves to send multicast out the wrong interface (check ip route get 224.0.0.251).
Step 2 — Watch the wire #
Eventually we stopped theorising and did the one thing that actually settles network arguments: look at the packets. Capture everything the scanner does:
1sudo tcpdump -i enp71s0 -n -l '(host 192.168.2.217 or udp port 5353 or arp)'
(Replace the interface and the scanner's IP with yours.)
What came back was the money shot. The scanner wasn't failing to discover the server — it was hammering a specific, hard-coded-looking IP that nobody owned:
ARP, Request who-has 192.168.2.11 tell 192.168.2.217
ARP, Request who-has 192.168.2.11 tell 192.168.2.217
ARP, Request who-has 192.168.2.11 tell 192.168.2.217 ...
About once a second, forever, with no reply. Check the local neighbor table and you see the same sad story:
1ip neigh | grep 192.168.2.11
2# 192.168.2.11 dev enp71s0 INCOMPLETE
INCOMPLETE = "I asked who has this IP and nobody answered." The scanner was talking to a ghost.
Step 3 — The real clue was a MAC address #
We knew 192.168.2.11 was the server's usual address. So why didn't it have it?
The network's DHCP server (dnsmasq, /etc/dnsmasq.d/local.conf) had a reservation pinning that name to that IP:
1dhcp-host=a8:a1:59:99:35:49,peschel,192.168.2.11,24h
Read that carefully: the reservation is keyed to a MAC address ending ...49. But the machine's active adapter had a different MAC:
1ip -o link show
2cat /sys/class/net/*/address
enp71s0 a8:a1:59:99:35:49 carrier=0 ← reserved for .32, cable unplugged
enp69s0 a8:a1:59:99:35:4b carrier=1 ← cable plugged in here
Two network ports, one cable. Someone had moved the cable from the Intel port (...49) to the Realtek port (...4b). A different port means a different MAC address, which means the DHCP reservation no longer matched, which means the machine quietly fell back to whatever the DHCP pool offered — 192.168.2.101 instead of .32.
The scanner, meanwhile, still believed the server lived at .32. It had been completely correct all along, just pointed at an address that no longer existed.
The fix: move the cable back to the original port. Scan works. The end.
Lessons (mostly for future-us) #
- "Can't see the server by name" is usually not a name problem. It's often "the server isn't where the client thinks it is."
- MAC addresses are tied to the physical port. Move a cable between NICs and you've effectively changed the machine's identity, DHCP reservations included.
- Watch the packets early. One
tcpdumpof the client ARPing a dead IP would have saved hours. INCOMPLETEinip neigh= a host that's being asked for and not answering. Great tell.- mDNS is best-effort and shared. It can be sabotaged by a chat app on the same port, poisoned by your Docker bridges, and confused by multi-homing. When it misbehaves, look at what's actually on
224.0.0.251:5353. - "System service" ≠ "owns the port". Avahi is systemd-managed and holds the naming logic, but port 5353 is still just shared UDP — any Electron app can bind it alongside.
.localis not DNS. It's multicast, resolved through NSS, defended by probing, and never answered by a normal DNS server.- Sometimes the computer is fine and the cable is in the wrong hole.