0

I am trying to block all traffic on a machine, except the outbound connection for an application with some ip's and ports. This is how I'm doing it but it's still blocked:

First, I turn on firewall and block all outbound connections for domain, private and public profile. After that, I run the follwing netsh commands in order to allow only the application traffic:

netsh advfirewall firewall add rule name="Allow_TCP_connection" program="%ProgramFiles% (x86)\Application\Application.exe" protocol=tcp remoteip=<ip> localport=<port1,port2> dir=out enable=yes action=allow profile=Private
netsh advfirewall firewall add rule name="Allow_UDP_connection" program="%ProgramFiles% (x86)\Application\Application.exe" protocol=udp remoteip=<ip> localport=<port1,port2> dir=out enable=yes action=allow profile=Private
0

Unless you specifically want to do it from a script, I strongly suggest you use the create Firewall Rule assistant. From the firewall admin page in MMC, right click the folder for Outbound rule, then Add rule and follow the instructions.

  • I also did this manually. Also after running the command I manually checked if the rules were created correctly – mhd Jun 15 '16 at 13:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.