测试系统为FreeBSD 4.11,经过了裁减,这个系统小于15M,不使用交换分区。
实验数据:
系统刚刚启动后的状态:
-sh-3.00# top -n 1
last pid: 81; load averages: 0.13, 0.04, 0.01 up 0+00:01:07 10:17:14
10 processes: 1 running, 9 sleeping
Mem: 7940K Active, 3504K Inact, 18M Wired, 9744K Buf, 471M Free
Swap:
PID USERNAME PRI NICE SIZE RES STATE TIME WCPU CPU COMMAND
81 root 28 0 4360K 1456K RUN 0:00 0.00% 0.00% top
-sh-3.00# vmstat 1
procs memory page disks faults cpu
r b w avm fre flt re pi po fr sr ad0 md0 in sy cs us sy id
0 0 0 11180 481840 107 1 2 0 53 0 0 0 2794 782 18 0 3 97
0 0 0 11180 481840 3 0 0 0 0 0 0 0 2646 10 5 0 0 100
0 0 0 16192 481840 3 0 0 0 0 0 0 0 2636 10 6 0 0 100
^C
-sh-3.00# ipnat -s
mapped in 0 out 0
added 0 expired 0
no memory 0 bad nat 0
inuse 0
rules 0
wilds 0
开始用Synflood,攻击建立连接映射:
-sh-3.00# vmstat 5
procs memory page disks faults cpu
r b w avm fre flt re pi po fr sr ad0 md0 in sy cs us sy id
0 0 0 23780 410816 57 0 1 0 40 0 0 0 2681 402 17 0 1 99
0 0 0 23780 397676 3 0 0 0 0 0 0 0 2653 21 6 0 0 100
0 0 0 18768 317836 3 0 0 0 0 0 0 0 2639 10 4 0 0 100
0 0 0 16600 203868 3 0 0 0 0 0 0 0 2639 10 4 0 0 100
0 0 0 20624 112072 3 0 0 0 0 0 0 0 2671 10 4 0 0 100
0 0 0 22792 33092 3 0 0 0 0 0 0 0 2707 26 5 0 0 100
0 0 0 22792 29208 3 0 0 0 0 0 0 0 2639 12 5 0 2 98
0 0 0 22792 29208 3 0 0 0 0 0 0 0 2638 10 5 0 0 100
^C
系统进入稳定状态:
-sh-3.00# top -n 1
last pid: 280; load averages: 0.00, 0.01, 0.00 up 0+00:06:45 10:22:52
11 processes: 1 running, 10 sleeping
Mem: 8720K Active, 4392K Inact, 459M Wired, 9744K Buf, 28M Free
Swap:
PID USERNAME PRI NICE SIZE RES STATE TIME WCPU CPU COMMAND
280 root 28 0 4360K 1576K RUN 0:00 0.00% 0.00% top
-sh-3.00# ipnat -s
mapped in 9998 out 1890899
added 1800000 expired 0
no memory 1307932 bad nat 52082
inuse 1800000
rules 42
wilds 0
可以看到内存已经尽可能地分配给了映射表,所剩已经很少了。映射表也已经达到了 ipnat 中定义的最大值。