Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
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

4 Answers 4

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

share|improve this answer
    
It's a standalone machine, no group policy. –  Tnkflx Nov 30 '11 at 16:26

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

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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