bash Nmap - RTTVAR 已经增长到超过 2.3 秒,减少到 2.0

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/40514044/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 22:27:26  来源:igfitidea点击:

Nmap - RTTVAR has grown to over 2.3 seconds, decreasing to 2.0

bashubuntuscriptingarpnmap

提问by cflinspach

I have a script that I'm using to build a config for icinga2. The network is large, multiple /13's large. When I run the script I keep getting the RTTVAR has grown to over 2.3 seconds, decreasing to 2.0 error. I've tried raising my gc_thresh and breaking up the subnets. I've dived through the little info from google and can't seem to find a fix. If anyone has any ideas, I'd really appreciate it. I'm on Ubuntu 16.04

我有一个脚本,用于为 icinga2 构建配置。网络很大,多个/13 的大。当我运行脚本时,我不断发现 RTTVAR 已经增长到超过 2.3 秒,减少到 2.0 错误。我试过提高我的 gc_thresh 并分解子网。我已经浏览了谷歌的小信息,似乎找不到解决办法。如果有人有任何想法,我将不胜感激。我在 Ubuntu 16.04

My script:

我的脚本:

# Find devices and create IP list
i=72
while [ $i -lt 255 ]
    do
    echo "$(date) - Scanning xx.$i.0.0/16" >> files/scan.log
    nmap -sn --host-timeout 5 xx.$i.0.0/16 -oG - | awk '/Up$/{print }' >> files/ip-list
    let i=i+1
    done

My /etc/sysctl.conf

我的 /etc/sysctl.conf

# Force gc to clean-up quickly
net.ipv4.neigh.default.gc_interval = 3600

# Set ARP cache entry timeout
net.ipv4.neigh.default.gc_stale_time = 3600

# Setup DNS threshold for arp 
net.ipv4.neigh.default.gc_thresh3 = 8192
net.ipv4.neigh.default.gc_thresh2 = 4096
net.ipv4.neigh.default.gc_thresh1 = 2048

Edit: added host-timeout 5 removed -n

编辑:添加主机超时 5 删除 -n

回答by OscarAkaElvis

I can suggest you tu use ping scan. If you want an "overall sight" of your network you can use

我可以建议你使用 ping 扫描。如果您想要网络的“整体视野”,您可以使用

nmap -sP -n

It decreases the time a little bit comparing to nmap -sn , you can check it with small examples.

与 nmap -sn 相比,它减少了一点时间,您可以通过小示例进行检查。

As I said in a comment. Use --host-timeout and --max-retries and that will improve your performance.

正如我在评论中所说。使用 --host-timeout 和 --max-retries 可以提高你的性能。