Responding to DNS port when it is not running
Connection to any IP address on port tcp/53 always responds/succeed when that IP isn't running DNS. I think something is responding from MacOS internally. How do we fix this?
MacBook Pro 14″, macOS 15.2
Connection to any IP address on port tcp/53 always responds/succeed when that IP isn't running DNS. I think something is responding from MacOS internally. How do we fix this?
MacBook Pro 14″, macOS 15.2
macOS itself uses a number of well-known ports, including 53 and 5353 for Bonjour multicast DNS discovery.
I don't think you can turn those off without breaking a number of subtle things the OS is doing (even if you set the most restrictive settings in the built-in Firewall - useless as it is - it will still allow a number of ports to receive connections). Third-party firewall similarly have built-in presets to allow these services to work properly and usually warn you that you will break stuff if you close them down.
But is there an actual issue here besides that your computer is responding to other devices on the local network that are advertising Bonjour services? Because that's how Bonjour and mDNS more generally is supposed to work...and, if you have certain devices on your network like AppleTVs, they may act as a sleep proxy for other devices on the network and respond to mDNS requests on their behalf when they are offline.
Then you should probably tcpdump the communications and see where it is going and who is responding.
sonamnamgyel wrote:
Connection to any IP address on port tcp/53 always responds/succeed when that IP isn't running DNS. I think something is responding from MacOS internally. How do we fix this?
It isn't doing that here. This is what I get:
/tmp $ nc -zv www.apple.com 53
nc: connectx to www.apple.com port 53 (tcp) failed: Operation timed out
Of course, I don't run any firewalls, network filters, 3rd party "security" or "privacy" apps.
sonamnamgyel wrote:
Connection to any IP address on port tcp/53 always responds/succeed when that IP isn't running DNS. I think something is responding from MacOS internally. How do we fix this?
? what is the bigger issue here, maybe you can paint a bigger picture
old issue, new issue, what changed?
ref: TCP and UDP ports used by Apple software products - Apple Support
You can refer to the result below:
# nc -zv www.apple.com 53
# Connection to www.apple.com port 53 [tcp/domain] succeeded!
It’s clear that www.apple.com doesn’t host a DNS service. However, when I test it using nc or nmap, the result indicates that the connection was successful. The question is, why does it show the port as open when it’s not actually running.
thank you.
OK, so the answer to that is that www.apple.com doesn't really exist - it's a CNAME for the Akamai CDN that Apple uses, and Akamai, like Cloudflare and other CDN, does run DNS.
Dig, NSLookup, or the DNS resolution tool of you choice on www.apple.com will clearly show you that it is a CNAME redirect, and you will get a different IP address each time.
nope!
I disagree that. The www.apple.com resolves to one of the Akamai CDN IP address and that IP address has only tcp 80 and 443 open.
Not just www.apple.com domain, literally every IP address I test, it shows tcp/53 is open.
Thanks.
Oh, for interest's sake, I played around a bit:
Not sure this is unexpected behaviour.
Responding to DNS port when it is not running