This repo is obsolete, please see git://git.code.sf.net/p/dummynet/code@master
[ipfw.git] / binary / testme.bat
1 @echo on\r
2 @set CYGWIN=nodosfilewarning\r
3 \r
4 @ipfw -q flush\r
5 @ipfw -q pipe flush\r
6 @echo ######################################################################\r
7 @echo ## Setting delay to 100ms for both incoming and outgoing ip packets ##\r
8 @echo ## and sending 4 echo request to Google                             ##\r
9 @echo ######################################################################\r
10 ipfw pipe 3 config delay 100ms mask all\r
11 ipfw add pipe 3 ip from any to any\r
12 ipfw pipe show\r
13 ping -n 4 www.google.it\r
14 \r
15 @echo ##############################################\r
16 @echo ## Raising delay to 300ms and pinging again ##\r
17 @echo ##############################################\r
18 ipfw pipe 3 config delay 300ms mask all\r
19 ipfw pipe show\r
20 ping -n 4 www.google.com\r
21 \r
22 @echo ##################################\r
23 @echo ## Shaping bandwidth to 500kbps ##\r
24 @echo ##################################\r
25 ipfw pipe 3 config bw 500Kbit/s mask all\r
26 ipfw pipe show\r
27 wget http://info.iet.unipi.it/~luigi/1m\r
28 @del 1m\r
29 \r
30 @echo ###################################\r
31 @echo ## Lowering bandwidth to 250kbps ##\r
32 @echo ###################################\r
33 ipfw pipe 3 config bw 250Kbit/s mask all\r
34 ipfw pipe show\r
35 wget http://info.iet.unipi.it/~luigi/1m\r
36 @del 1m\r
37 \r
38 @echo ###################################################################\r
39 @echo ## Simulating 50 percent packet loss and sending 15 echo request ##\r
40 @echo ###################################################################\r
41 @ipfw -q flush\r
42 @ipfw -q pipe flush\r
43 ipfw add prob 0.5 deny proto icmp in\r
44 ping -n 15 -w 300 www.google.it\r
45 @ipfw -q flush\r
46 \r
47 @echo ##############################\r
48 @echo ## Showing SYSCTL variables ##\r
49 @echo ##############################\r
50 ipfw sysctl -a\r
51 \r
52 @echo #############################################\r
53 @echo ## Inserting rules to test command parsing ##\r
54 @echo #############################################\r
55 @echo -- dropping all packets of a specific protocol --\r
56 ipfw add deny proto icmp\r
57 @echo -- dropping packets of all protocols except a specific one --\r
58 ipfw add deny not proto tcp\r
59 @echo -- dropping all packets from IP x to IP y --\r
60 ipfw add deny src-ip 1.2.3.4 dst-ip 5.6.7.8\r
61 @echo -- dropping all ssh outgoing connections --\r
62 ipfw add deny out dst-port 22\r
63 @echo -- allowing already opened browser connections --\r
64 @echo -- but preventing new ones from being opened   --\r
65 ipfw add deny out proto tcp dst-port 80 tcpflags syn\r
66 @echo -- another way to do the same thing --\r
67 ipfw add allow out proto tcp dst-port 80 established\r
68 ipfw add deny out proto tcp dst-port 80 setup\r
69 @echo -- checking what rules have been inserted --\r
70 ipfw -c show\r
71 @ipfw -q flush\r
72 \r
73 @echo #################\r
74 @echo ## Cleaning up ##\r
75 @echo #################\r
76 ipfw -q flush\r
77 ipfw -q pipe flush\r
78 \r
79 pause\r