How to use Windows netsh firewall command to allow only specific ipaddress on all port and deny all other ipaddress

netshwindows-firewallwindows-server-2008-r2

I require a configuration of firewall which will allow me connection through only specific ip-address say 10.0.0.1 on all port ranging from 0-5555 and deny all other ip-addresses?

What will be the syntax of netsh firewall command to generate this type of rule on Windows 2008R2 machine?

Best Answer

You can use these commands:

netsh advfirewall firewall add rule name="My Trusted In" dir=in action=allow protocol=ANY remoteip=62.9.97.12

netsh advfirewall firewall add rule name="My Trusted Out" dir=out action=allow protocol=ANY remoteip=62.9.97.12