4.1 MMAPed pcap
On Linux, a modified version of libpcap is available that implements a shared memory ring buffer. Phil Woods (cpw@lanl.gov) is the current maintainer of the libpcap implementation of the shared memory ring buffer. The shared memory ring buffer libpcap can be downloaded from his website at http://public.lanl.gov/cpw/.
Instead of the normal mechanism of copying the packets from kernel memory into userland memory, by using a shared memory ring buffer, libpcap is able to queue packets into a shared buffer that Snort is able to read directly. This change speeds up Snort by limiting the number of times the packet is copied before Snort gets to perform its detection upon it.
Once Snort linked against the shared memory libpcap, enabling the ring buffer is done via setting the enviornment variable PCAP_FRAMES. PCAP_FRAMES is the size of the ring buffer. According to Phil, the maximum size is 32768, as this appears to be the maximum number of iovecs the kernel can handle. By using PCAP_FRAMES=max, libpcap will automatically use the most frames possible. On Ethernet, this ends up being 1530 bytes per frame, for a total of around 52 Mbytes of memory for the ring buffer alone.
那么在ubuntu下:
在启动脚本中加入export PCAP_FRAMES=32768
版权声明:本文为博主原创文章,未经博主允许不得转载。
MMAPedpcap与Snort优化
本文介绍了一种通过使用MMAPedpcap实现的共享内存环形缓冲区来优化Snort性能的方法。该技术减少了数据包从内核空间复制到用户空间的次数,从而加快了Snort的检测速度。在Ubuntu环境下,通过设置环境变量PCAP_FRAMES为最大值32768来启用此功能。
619

被折叠的 条评论
为什么被折叠?



