Win2003 Batch code _win server with IP Security policy to restrict Udp-flood contract

Source: Internet
Author: User

Before the introduction of Linux through the iptables limit UDP contract, this record of Windows 2003 implementation methods.

Create a new Bat script, add the following, and then click Run.

Copy Code code as follows:

: Created by Http://www.jb51.net
:D ROP UDP Flood
@echo off
Cls
: Get DNS Address
For/f "delims=: tokens=1,2"%%a in (' Ipconfig/all ^|findstr/i ' DNS Server ') does (
Set Dnsip=%%b
)
: New IP installation policy prohibit UDP
netsh ipsec static add policy name= prohibit UDP description= allow DNS, deny other UDP outgoing
: New IP Security rule
netsh ipsec static add filterlist name= allow UDP
netsh ipsec static add filterlist name= deny UDP
: New IP Filter
netsh ipsec static add filter filterlist= allows UDP srcaddr=me dstaddr=%dnsip% description= allow DNS queries PROTOCOL=UDP Mirrored=yes D stport=53
netsh ipsec static add filter filterlist= deny UDP srcaddr=me dstaddr=any description= prohibit UDP outgoing PROTOCOL=UDP mirrored=yes
: New IP filter action
netsh ipsec static add filteraction name= allows DNS queries Action=permit
netsh ipsec static add filteraction name= rejects UDP outgoing Action=block
: Encapsulating policies
netsh ipsec static add rule name= Allow rules policy= disable UDP filterlist= allow UDP filteraction= allow DNS queries
netsh ipsec static add rule name= deny policy= prohibit UDP filterlist= deny UDP filteraction= deny outgoing
: Apply IP Security Policy
netsh ipsec static set policy name= prohibit UDP assign=y

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.