一、简介

  FastNetMon这是一个基于多种抓包引擎(NetFlow, IPFIX, sFLOW, netmap, PF_RING, PCAP)的DoS/DDoS攻击高效分析工具,可以探测和分析网络中的异常流量情况,同时可以通过外部脚本通知或阻断攻击。

特性:

  1)可处理入/出口流量
  2)如果发现某个IP发出异常流量,可触发封禁脚本
  3)可通过ExaBGP将封禁IP通知BGP路由器
  4)可在1-2秒内发现DoS/DDoS
  5)支持插件
  6)测试最高支持10GE、5-6 Mpps(Intel i7 2600 & Intel Nic 82599)

二、安装FastNetMon

wget https://raw.githubusercontent.com/FastVPSEestiOu/fastnetmon/master/src/fastnetmon_install.pl -Ofastnetmon_install.pl
perl fastnetmon_install.pl

It's REQUIRED to add all of your networks in CIDR notation (11.22.33.0/24) to the file /etc/networks_list in the form of one prefix per line.

Start main process:

/opt/fastnetmon/fastnetmon 

Start the client process in another console:

/opt/fastnetmon/fastnetmon_client

To enable fastnetmon to start on server startup, please add the following line to /etc/rc.local:

/opt/fastnetmon/fastnetmon --daemonize

If something goes wrong, please check logs:

tail -f /var/log/fastnetmon.log

The first time when threshold exceed (at this step we know IP, direction and power of attack). Second when we collect 100 packets for detailed audit of what happened. A sample script is provided and can be installed as follows:

cp /usr/src/fastnetmon/src/notify_about_attack.sh /usr/local/bin/notify_about_attack.sh
chmod 755 /usr/local/bin/notify_about_attack.sh

三、使用 pf_ring 作为 FastNetMon 的抓包引擎

首先编辑文件 /etc/fastnetmon.conf,将 mirror 的值改为 on ,这将使用 pf_ring 作为抓包引擎。

# PF_RING traffic capture, enough fast but wire speed version need paid license
mirror = on

同时,可以顺便把报警阈值调小一点,方便后面测试攻击。

# Limits for Dos/DDoS attacks 
threshold_pps = 200
threshold_mbps = 10
threshold_flows = 350

Start main process:

/opt/fastnetmon/fastnetmon 

Start the client process in another console:

/opt/fastnetmon/fastnetmon_client

四、模拟 DDoS 攻击测试 FastNetMon

编辑 /usr/local/bin/notify_about_attack.sh这个脚本,找到 ban 的条件语句,由于只是进行测试,我仅仅输出一条消息到 /tmp/ban.log 日志中。

if [ "$4" = "ban" ]; then
echo "FastNetMon Guard: IP $1 blocked because $2 attack with power $3 pps" >> /tmp/ban.log
exit 0
fi

我使用一款叫做 iperf 的工具来模拟 DDoS 攻击,这个工具一般用于测试网络带宽,当然也可以通过大量发包模拟一次 DDoS 攻击。

在 CentOS 上可以通过 yum 直接安装 iperf:yum install iperf

然后通过iperf -su命令启动 iperf 的服务器端。

这里 -u 参数指明侦听 udp 端口。

我将我的 mbp 作为攻击的发器端,同样安装 iperf : brew install iperf

在客户端上向服务器发起探测:iperf -u -c 10.1.2.137 -b 100M -P 5

这时,在服务器上执行 FastNetMon 的客户端命令 /opt/fastnetmon/fastnetmon_clinet进行查看,

可以看到出现如下信息。

FastNetMon v1.0 FastVPS Eesti OU (c) VPS and dedicated: http://FastVPS.host
IPs ordered by: packets
Incoming traffic 42594 pps 491 mbps 0 flows
10.1.2.137 35552 pps 410 mbps 0 flows *banned* Outgoing traffic 1 pps 0 mbps 0 flows
10.1.2.137 1 pps 0 mbps 0 flows *banned* Internal traffic 0 pps 0 mbps Other traffic 0 pps 0 mbps Screen updated in: 0 sec 191 microseconds
Traffic calculated in: 0 sec 7 microseconds
Total amount of not processed packets: 0
Packets received: 404792
Packets dropped: 0
Packets dropped: 0.0 % Ban list:
10.1.2.137/35552 pps incoming at 04_06_16_00:40:13

因为之前我设置了攻击阈值为 200 pps,10 mb,目前的这个负载量已经远远超过我设定的阈值,被认为遭到了攻击。可以看到,目前 10.1.2.137 这个 IP 已经被拉进 Ban list 之中了。

现在我们查看 FastNetMon 是否触发了通知,查看 /tmp/ban.log 这个日志,可以看到通知的消息。

FastNetMon Guard: IP 10.1.2.137 blocked because incoming attack with power 293 pps

FastNetMon 确实触发了通知的操作。

五、FastNetMon 集成 InfluxDB

  InfluxDB 是一款开源的分布式时钟、事件和指标数据库。使用 Go 语言编写,它易于分布式和水平伸缩扩展。 InfluxDB 本身提供了非常简单易用的 HTTP API,因此它经常用于监控程序的后端数据存储,Grafana 对它就有非常好的支持。

它有三大特性:

  1. Time Series(时间序列):你可以使用与时间有关的相关函数,如最大,最小,求和等。
  2. Metrics(度量):你可以实时对大量数据进行计算。
  3. Eevents(事件):它支持任意的事件数据。

先来安装 InfluxDB

wget https://dl.influxdata.com/influxdb/releases/influxdb-0.13.0.x86_64.rpm
yum localinstall influxdb

编辑 InfluxDB 的配置文件 /etc/influxdb/influxdb.conf 中的 graphite 选项,按照如下配置:

[[graphite]]
enabled = true
bind-address = ":2003"
protocol = "tcp"
consistency-level = "one" batch-size = 5000
batch-timeout = "1s"
separator = "." templates = [
"fastnetmon.hosts.* app.measurement.cidr.direction.function.resource",
"fastnetmon.networks.* app.measurement.cidr.direction.resource",
"fastnetmon.total.* app.measurement.direction.resource"
]

现在就可以启动 InfluxDB 了。

# /etc/init.d/influxdb start
Starting the process influxdb [ OK ]
influxdb process was started [ OK ]

同样,需要在 FastNetMon 的配置文件 /etc/fastnetmon.conf 里做一些配置:

graphite = on
graphite_host = 127.0.0.1
graphite_port = 2003
graphite_prefix = fastnetmon

然后重启 FastNetMon

等待几秒,接下来登录 Influxdb shell,查看数据库里是否有数据了。

# influx
Visit https://enterprise.influxdata.com to register for updates, InfluxDB server management, and monitoring.
Connected to http://localhost:8086 version 0.13.0
InfluxDB shell version: 0.13.
> show databases
name: databases
---------------
name
graphite
_internal > use graphite
Using database graphite
> show measurements
name: measurements
------------------
name
fastnetmon.10_1_2_137.incoming.flows
fastnetmon.10_1_2_137.incoming.mbps
fastnetmon.10_1_2_137.incoming.pps
fastnetmon.10_1_2_137.outgoing.flows
fastnetmon.10_1_2_137.outgoing.mbps
fastnetmon.10_1_2_137.outgoing.pps
fastnetmon.172_26_1_1.incoming.flows
fastnetmon.172_26_1_1.incoming.mbps
fastnetmon.172_26_1_1.incoming.pps
fastnetmon.172_26_1_1.outgoing.flows
fastnetmon.172_26_1_1.outgoing.mbps
fastnetmon.172_26_1_1.outgoing.pps
fastnetmon.incoming.mbps
fastnetmon.incoming.pps
fastnetmon.incomingflows
fastnetmon.outgoing.mbps
fastnetmon.outgoing.pps
fastnetmon.outgoingflows > select * from "fastnetmon.incoming.pps" order by time desc limit
name: fastnetmon.incoming.pps
-----------------------------
time value

Influxdb shell

高效的DDoS攻击探测与分析工具——FastNetMon的更多相关文章

  1. 高效的DDoS攻击探测与分析工具 – FastNetMon

    快速使用Romanysoft LAB的技术实现 HTML 开发Mac OS App,并销售到苹果应用商店中.   <HTML开发Mac OS App 视频教程> 土豆网同步更新:http: ...

  2. 被人DDoS攻击了,分析一下原理和防护

    一.行业现象 1.1 为什么要攻击? 常见的,一个是同行恶意竞争,一个是敲诈勒索. 无论是传统行业的线下门店,还是互联网行业的门户网站.APP产品,都存在着竞争关系,争相获得更多客源,究其目的,无非是 ...

  3. DDoS 攻击与防御:从原理到实践

    本文来自 网易云社区 . 可怕的 DDoS 出于打击报复.敲诈勒索.政治需要等各种原因,加上攻击成本越来越低.效果特别明显等趋势,DDoS 攻击已经演变成全球性的网络安全威胁. 危害 根据卡巴斯基 2 ...

  4. DDoS 攻击与防御:从原理到实践(下)

    欢迎访问网易云社区,了解更多网易技术产品运营经验. DDoS 攻击与防护实践 DDoS 攻击的实现方式主要有如下两种: 自建 DDoS 平台 现在有开源的 DDoS 平台源代码,只要有足够机器和带宽资 ...

  5. 全年DDoS攻击分析|知道创宇云安全2018年度网络安全态势报告

    *本报告由知道创宇云安全出品* 数据来源:知道创宇云防御平台 前言 2018年,网络安全领域暗流涌动,攻击趋势不断攀升,T级DDoS攻击多次爆发.数据泄露事件层出不穷.勒索软件大行其道.此外,随着我国 ...

  6. 记一次被自己DDOS攻击

    服务器报警初步分析进一步分析最终分析总结 TOC 服务器报警 7月24号下午5点半开始,突然服务器报警,检查监控,发现CPU异常100%. 该服务器正常情况下CPU使用率在40%已经算高了,另外负载经 ...

  7. DDOS 攻击工具

    DDOS  攻击工具 使用github上的DDOS攻击工具 https://github.com/Ha3MrX/DDos-Attack 将python脚本拷贝到主机,使用 chmod +x ddos- ...

  8. DDoS攻击工具

    DDoS攻击工具 综合性工具 综合性工具除了可以进行DDoS攻击外,还可用于其他的用途,例如:端口扫描.安全审计.防火墙等.实际上,大部分综合性工具开发的原始目的并不是用于DDoS,而是"网 ...

  9. 免费DDOS攻击测试工具大合集

    FreeBuf微科普: DoS(Denial Of Service)攻击是指故意的攻击网络协议实现的缺陷或直接通过野蛮手段残忍地耗尽被攻击对象的资源,目的是让目标计算机或网络无法提供正常的服务或资源访 ...

随机推荐

  1. 关于ASP.NET控件方面的学习(恢复版)

    前段时间没有把学习中的遇到的问题和解决方法详细总结,今天整理整理.. 鉴于我们这个研究生论文管理系统是小组形式,所以说虽然我只负责数据库,但是其它部分也多少有些工作方面的涉及,最后感谢各位同学和老师的 ...

  2. IOS 生成设备唯一标识

    前言 iOS设备5.0以上放弃使用[[UIDevice currentDevice] uniqueIdentifier]来获得设备唯一ID iOS设备私有方法禁止用户获取和使用IMEI 需求 需要一个 ...

  3. NOIP2012 借教室 Splay初探

    终于把区间操作的Splay搞明白了…… Splay的大致框架是这样的: [代码中的Zig-Zig和Zig-Zag操作其实是可以优化的,实际只需要3次passDown和3次update] templat ...

  4. Linux下安装SVN服务(CentOS7下)

    1. 安装 centos(我这里使用的是CentOS7)下yum命令即可方便的完成安装 测试安装是否成功: 2. 建立版本库 创建svn数据目录(subversion默认是把/var/svn作为数据根 ...

  5. .net程序员必须知道的知识

    A while back, I posted a list of ASP.NET Interview Questions. Conventional wisdom was split, with ab ...

  6. ffmepg命令行参数

    ffmpeg使用 有些选项在每个流中都必须指定,例如比特率bitrate或编解码codec.指定流的字符串一般都会有各参数名称和参数,如编解码"-codec:a:1 ac3"表明第 ...

  7. 《学习Opencv》第五章 习题6

    这是第五章 习题5.6的结合版,其中实现了摄像头抓拍功能,能够成功运行. #include "stdafx.h" #include "cv.h" #includ ...

  8. UIview lianxi

    // 创建一个和屏幕大小相同的window,记住[UIScreen mainScreen].bounds 是获取当前屏幕大小 self.window = [[[UIWindow alloc] init ...

  9. phread_con_wait和pthread_mutex_lock实现的生产者消费者模型

    条件变量是利用线程间共享的全局变量进行同步的一种机制, 主要包括两个动作:一个线程等待"条件变量的条件成立"而挂起: 另一个线程使"条件成立"(给出条件成立信号 ...

  10. java Active Object模式(下)

    Active Object模式的评价与实现考量 Active Object模式通过将方法的调用与执行分离,实现了异步编程.有利于提高并发性,从而提高系统的吞吐率. Active Object模式还有个 ...