Search code examples
firewalliptableswindows-firewallnetshipfw

Using netsh advfirewall to block URLs in Windows


I know that Windows allow blocking IP addresses through netsh like so:

netsh advfirewall firewall add rule name="Block some stuff" dir=in action=block remoteip=xxx.xxx.xxx.xxx enable=yes

But is there any way to use netsh (or is there any other Windows utility) to block URLs like how ipfw and iptables allows? I know there's wipfw, but I'd like to use something built in if possible.


Solution

  • Use nslookup to resolve dns/ip of the url and block that ip using netsh. Or, you may add an exception in hosts file in Windows.