0

Is it possible to block all incoming and outgoing traffic on a Windows XP host via batch file?

Bonus question, I only want to allow 1 outgoing port and all traffic going over that port.

Tnkflx
  • 1
  • 1
  • 1
    Clarify the "bonus question". Do you mean you want the machine to act as normal and make all normal traffic use a single port?! – Ben Campbell Nov 30 '11 at 22:21

5 Answers5

1

You can set it using group policy instead of a batch file.

JamesRyan
  • 8,166
  • 2
  • 25
  • 36
1

Use netsh advfirewall firewall command to configure windows firewall. See http://technet.microsoft.com/en-us/library/dd734783.aspx#BKMK_3_add for details.

Matej
  • 193
  • 1
  • 6
0

The only method that occurs to me directly via bat file is using netsh commands to severely restrict the internal network settings... filtering and such. I'm still not convinced this will work the way you want. I'm not sure why you would use a bat file method when you could just use a software firewall and just whitelist the traffic as you see fit. However, you may be able to enable or disable a firewall configuration with a bat file that could have the desired effect.

Ben Campbell
  • 567
  • 4
  • 16
0

Even if there would be such a command (and there isn't), then you can't block outgoing traffic, as only the newer Windows versions have outgoing firewall support. Use a recent version of Windows.

mailq
  • 17,023
  • 2
  • 37
  • 69
-1
netsh advfirewall firewall add rule name="BlockPort01" protocol=TCP dir=out remoteport=01 action=block
Jenny D
  • 27,780
  • 21
  • 75
  • 114