Stop Chrome from Listening on UDP Port 5353

03 May 2020

I use Avahi on all my linux devices on my home network so that I can connect to devices using <hostname>.local instead of local IP addresses. This works well with Mac OS's Bonjour too and is arguably better than assigning static IP addresses to each device on my network which requires maintanence.

It works pretty well.

... except sometimes it doesn't.

Looking at avahi-daemon.service logs, it says:

*** WARNING: Detected another IPv6 mDNS stack running on this host. This makes mDNS unreliable and is thus not recommended. ***

Avahi ArchWiki suggets disabling systemd-resolved's built-in DNS service. Done that. No luck.

It was until I stumbled upon avahi-daeon's manpage, specifically disallow-other-stacks=. It says:

Takes a boolean value ("yes" or "no"). If set to "yes" no other process is allowed to bind to UDP port 5353. ...

What the Hell Chrome?

I then checked what process is binding to 5353 port of my machine. Running lsof -i UDP:

chrome  2965 andy  219u  IPv4 114996      0t0  UDP
chrome  3001 andy   78u  IPv4 118957      0t0  UDP (output)

Why the hell is Chrome using 5353 by default?

Searched online and there was the chrome://flags/#device-discovery-notifications flag that disables Chrome's discovery service. Except this flag is also gone. Solution as of writing is to create a policy. Copying the solution from Zieboll's article:

$ mkdir -p /etc/opt/chrome/policies/managed
$ echo '{ "EnableMediaRouter": false }' > /etc/opt/chrome/policies/managed/disable_mediarouter.json