You can do this in any browser using uBlock Origin, just enable the built in Block Outsider Intrusion into LAN
list in the Privacy
category. (it’s disabled by default)
Here it is if you wanna look at it: https://github.com/uBlockOrigin/uAssets/blob/master/filters/lan-block.txt (but no need to paste it into ublock, it’s built in just disabled)
You need to look under filter lists.