-
Notifications
You must be signed in to change notification settings - Fork 0
/
ipsec5.bat
54 lines (49 loc) · 2.03 KB
/
ipsec5.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
rem ##http://tilt.lib.tsinghua.edu.cn/node/518
REM =================开始咯================
netsh ipsec static ^
delete policy name=Haishion
netsh ipsec static ^
add policy name=Haishion
REM 添加2个动作,禁止和允许
netsh ipsec static ^
add filteraction name=Perm action=permit
netsh ipsec static ^
add filteraction name=Block action=block
REM 首先干掉所有访问
netsh ipsec static ^
add filterlist name=AllAccess
netsh ipsec static ^
add filter filterlist=AllAccess srcaddr=Me dstaddr=Any
netsh ipsec static ^
add rule name=BlockAllAccess policy=Haishion filterlist=AllAccess filteraction=Block
REM 开放某些IP无限制访问
netsh ipsec static ^
add filterlist name=UnLimitedIP
netsh ipsec static ^
add filter filterlist=UnLimitedIP srcaddr=210.34.0.1 dstaddr=Me
netsh ipsec static ^
add filter filterlist=UnLimitedIP srcaddr=210.34.0.2 dstaddr=Me
netsh ipsec static ^
add rule name=AllowUnLimitedIP policy=Haishion filterlist=UnLimitedIP filteraction=Permit
REM 开放某些端口
netsh ipsec static ^
add filterlist name=OpenSomePort
netsh ipsec static ^
add filter filterlist=OpenSomePort srcaddr=Any dstaddr=Me dstport=20 protocol=TCP
netsh ipsec static ^
add filter filterlist=OpenSomePort srcaddr=Any dstaddr=Me dstport=21 protocol=TCP
netsh ipsec static ^
add filter filterlist=OpenSomePort srcaddr=Any dstaddr=Me dstport=80 protocol=TCP
netsh ipsec static ^
add rule name=AllowOpenSomePort policy=Haishion filterlist=OpenSomePort filteraction=Permit
REM 开放某些ip可以访问某些端口
netsh ipsec static ^
add filterlist name=SomeIPSomePort
netsh ipsec static ^
add filter filterlist=SomeIPSomePort srcaddr=Me dstaddr=Any dstport=53 protocol=UDP
netsh ipsec static ^
add filter filterlist=SomeIPSomePort srcaddr=Me dstaddr=Any dstport=80 protocol=TCP
netsh ipsec static ^
add filter filterlist=SomeIPSomePort srcaddr=210.34.0.3 dstaddr=Me dstport=8080 protocol=TCP
netsh ipsec static ^
add rule name=AllowSomeIPSomePort policy=Haishion filterlist=SomeIPSomePort filteraction=Permit