Skip to content

Instantly share code, notes, and snippets.

@mzpqnxow
Last active March 10, 2026 21:21
Show Gist options
  • Select an option

  • Save mzpqnxow/ff88b5a519f5c3303ef8bc9de0245179 to your computer and use it in GitHub Desktop.

Select an option

Save mzpqnxow/ff88b5a519f5c3303ef8bc9de0245179 to your computer and use it in GitHub Desktop.
Disable MDNS in Chrome via Chrome policies on the commandline
#!/bin/bash
#
# Disable mDNS for Chrome, Chromium and Brave
# Used on Debian 13
#
# Confirm it works:
# $ lsof -n -i -P | grep -F '224.'
#
# You can/should also just disable multicast on your interfaces if you don't need it
# $ sudo ifconfig $iface -multicast
#
# @mzpqnxow
# Updated 2026
#
set -euo pipefail
config_blob='{ "EnableMediaRouter": false }'
bases=(
/etc/opt/chrome
/etc/brave
/etc/chromium
)
for base in "${bases[@]}"; do
file="$base/policies/managed/disable_mdns.json"
if [[ -f $file ]]; then
echo "Skipping $file (already exists) with the following content:"
echo "=== $file ==="
echo
cat "$file"
echo
echo
continue
fi
echo "Setting $file"
printf '%s\n' "$config_blob" |
sudo install -Dm644 /dev/stdin "$file"
done
@mzpqnxow

Copy link
Copy Markdown
Author

BTW- there are probably extensions that can disable the mDNS- but a pure configuration change is so much better than adding more code to your system- even if it is (mostly) sandboxed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment