centos利用cloudflare的bpf-tools實現ddos防護

來源:互聯網
上載者:User

標籤:

概念

利用BPF( Berkeley Packet Filter)工具集結合iptables的xt_bpf模組可以實現高效能包過濾,從而應對大規模的ddos攻擊。BPF Tools包含一組簡單的python指令碼,一部分用於分析pcap檔案,其它主要用於產生bpf位元組碼。

 

一、下載並安裝bpftools

在https://github.com/cloudflare/bpftools下載zip檔案解壓,也可以通過git下載,然後編譯,安裝指令碼如下:

#!/bin/bash#yum -y kernel-headersyum -y install python-setuptools libpcap-devel readline-devel binutils-devel bison flexeasy_install pcappyeasy_install argparsecd ./linux_tools/makecd ..

  

二、測試

  2.1 抓取部分包資料用於測試

tcpdump -i eth0 -s0 -w sample.pcap  -c 10000 

  2.2 可以把sample.pcap轉成ascii查看

cat sample.pcap |./pcap2hex --ascii|head

  2.3 用parsedns查看詳細dns資訊

./parsedns 04f938b79dab00238ba9f9d9080045000041c547000040117b6b3da495fa4137252400355bde002d3a380879800500010000000000000339383205733737776905626361626403636f6d0000010001

  2.4 測試過濾規則

cat sample.pcap | ./filter -b "`./bpfgen --offset 14 dns -- *.bcc??.com`" | tcpdump -nr - | more

  

三、布署

 

 

 

 

參考:https://blog.cloudflare.com/introducing-the-bpf-tools/

centos利用cloudflare的bpf-tools實現ddos防護

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.