最近安装了比特彗星(bitcomet)后,老是收到警告说日志的接收超过每秒上限了。一看日志,好家伙,一堆的kern.info kernel: [194004.157620] neighbour: arp_cache: neighbor table overflow!
日志,还是kernel的,还是info的?
Sat Jan 28 15:47:41 2023 kern.warn kernel: [474996.419813] net_ratelimit: 1279 callbacks suppressed
Sat Jan 28 15:47:41 2023 kern.info kernel: [474996.419824] neighbour: arp_cache: neighbor table overflow!
Sat Jan 28 15:47:41 2023 kern.info kernel: [474996.424599] neighbour: arp_cache: neighbor table overflow!
Sat Jan 28 15:47:41 2023 kern.info kernel: [474996.426614] neighbour: arp_cache: neighbor table overflow!
Sat Jan 28 15:47:41 2023 kern.info kernel: [474996.433420] neighbour: arp_cache: neighbor table overflow!
Sat Jan 28 15:47:41 2023 kern.info kernel: [474996.433737] neighbour: arp_cache: neighbor table overflow!
Sat Jan 28 15:47:41 2023 kern.info kernel: [474996.434832] neighbour: arp_cache: neighbor table overflow!
Sat Jan 28 15:47:41 2023 kern.info kernel: [474996.435122] neighbour: arp_cache: neighbor table overflow!
Sat Jan 28 15:47:41 2023 kern.info kernel: [474996.435789] neighbour: arp_cache: neighbor table overflow!
Sat Jan 28 15:47:41 2023 kern.info kernel: [474996.436122] neighbour: arp_cache: neighbor table overflow!
Sat Jan 28 15:47:41 2023 kern.info kernel: [474996.440968] neighbour: arp_cache: neighbor table overflow!
Sat Jan 28 15:47:46 2023 kern.warn kernel: [475001.544054] net_ratelimit: 2432 callbacks suppressed
Sat Jan 28 15:47:46 2023 kern.info kernel: [475001.544064] neighbour: arp_cache: neighbor table overflow!
Sat Jan 28 15:47:46 2023 kern.info kernel: [475001.545075] neighbour: arp_cache: neighbor table overflow!
Sat Jan 28 15:47:46 2023 kern.info kernel: [475001.546204] neighbour: arp_cache: neighbor table overflow!
Sat Jan 28 15:47:46 2023 kern.info kernel: [475001.548341] neighbour: arp_cache: neighbor table overflow!
Sat Jan 28 15:47:46 2023 kern.info kernel: [475001.549918] neighbour: arp_cache: neighbor table overflow!
Sat Jan 28 15:47:46 2023 kern.info kernel: [475001.550398] neighbour: arp_cache: neighbor table overflow!
Sat Jan 28 15:47:46 2023 kern.info kernel: [475001.551738] neighbour: arp_cache: neighbor table overflow!
Sat Jan 28 15:47:46 2023 kern.info kernel: [475001.552784] neighbour: arp_cache: neighbor table overflow!
Sat Jan 28 15:47:46 2023 kern.info kernel: [475001.553170] neighbour: arp_cache: neighbor table overflow!
Sat Jan 28 15:47:46 2023 kern.info kernel: [475001.556931] neighbour: arp_cache: neighbor table overflow!
网上找问题原因、解决方法,最接近的就是lede的这个issue https://github.com/coolsnowwolf/lede/issues/6427#issuecomment-785553693,https://github.com/coolsnowwolf/lede/issues/6612
两个东西共同造成的arp_cache: neighbor table overflow!
-
在openwrt中打开了FullCone NAT(全锥NAT)
-
在比特彗星(bitcomet)中默认设置了network.max_udp_pkt_per_sec(每秒最大udp数据包发送量)为1000
issue中提供的解决方法有两:
- 要么: 关闭Full Cone NAT
💡个人情况
我没用到nat、upnp,而是使用ipv6做端口监听,所以关了没作用 - 要么: 将network.max_udp_pkt_per_sec调小,比如100
但至于这些东西是什么?做什么的?什么意思?为啥这样这样就会有日志警告?那样那样设置就没有警告?是否有更好的解决方案?
下面逐一研究一下
arp cache和neighbor table
参考:
- Linux: Neighbour Table Overflow Error and Solution - https://www.cyberciti.biz/faq/centos-redhat-debian-linux-neighbor-table-overflow/
首先搞清楚哪里出现的日志信息
根据日志的含义,大概是arp表出现了问题(arp的邻居表溢出)。
💡关于arp(地址解析协议)的基本概念 - <>
查看arp表,没发现啥问题()
$ arp –a
IP address HW type Flags HW address Mask Device
192.168.1.1 0x1 0x2 xxxxxxx * br-lan
192.168.1.2 0x1 0x2 xxxxxxx * br-lan
192.168.1.3 0x1 0x2 xxxxxxx * br-lan
192.168.1.4 0x1 0x2 xxxxxxx * br-lan
192.168.1.5 0x1 0x2 xxxxxxx * br-lan
192.168.1.6 0x1 0x2 xxxxxxx * br-lan
192.168.1.7 0x1 0x2 xxxxxxx * br-lan
192.168.1.8 0x1 0x2 xxxxxxx * br-lan
查看配置信息
net.ipv4.neigh.default.gc_thresh1 ── 存在于ARP高速缓存中的最少层数,如果少于这个数,垃圾收集器将不会运行。缺省值是128。
net.ipv4.neigh.default.gc_thresh2 ── 保存在 ARP 高速缓存中的最多的记录软限制。垃圾收集器在开始收集前,允许记录数超过这个数字 5 秒。缺省值是 512。
net.ipv4.neigh.default.gc_thresh3 ── 保存在 ARP 高速缓存中的最多记录的硬限制,一旦高速缓存中的数目高于此,垃圾收集器将马上运行。缺省值是1024。
net.ipv4.neigh.default.gc_stale_time ── 决定检查一次相邻层记录的有效性的周期。当相邻层记录失效时,将在给它发送数据前,再解析一次。缺省值是60秒。
$ sysctl net.ipv4.neigh.default.gc_thresh1
net.ipv4.neigh.default.gc_thresh1 = 128
$ sysctl net.ipv4.neigh.default.gc_thresh2
net.ipv4.neigh.default.gc_thresh2 = 512
$ sysctl net.ipv4.neigh.default.gc_thresh3
net.ipv4.neigh.default.gc_thresh3 = 1024
$ sysctl net.ipv4.neigh.default.gc_interval
net.ipv4.neigh.default.gc_interval = 30
$ sysctl net.ipv4.neigh.default.gc_stale_time
net.ipv4.neigh.default.gc_stale_time = 60
$ grep . /proc/sys/net/ipv4/neigh/default/gc_thresh*
/proc/sys/net/ipv4/neigh/default/gc_thresh1:128
/proc/sys/net/ipv4/neigh/default/gc_thresh2:512
/proc/sys/net/ipv4/neigh/default/gc_thresh3:1024
# 编辑配置文件
vi /etc/sysctl.conf
# ========================
# Append the following values (this is taken from server that protects over 200 desktops running MS-Windows, Linux, and Apple OS X):
## works best with <= 500 client computers ##
# 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 = 4096
net.ipv4.neigh.default.gc_thresh2 = 2048
net.ipv4.neigh.default.gc_thresh1 = 1024
# ========================
# 加载配置,使变更生效
sysctl -p
todo
FullCone NAT(全锥NAT)
更多: 关于全锥NAT、路由器四种NAT(Full Cone NAT/Restricted Cone NAT/Port Restricted Cone NAT/Symmetric NAT) - https://lawsssscat.blog.csdn.net/article/details/104637117文章来源:https://www.toymoban.com/news/detail-791733.html
简单来说,开启full cone nat后,文章来源地址https://www.toymoban.com/news/detail-791733.html
Bitcomet为啥发送udp包
到了这里,关于【笔记】openwrt - full cone NAT(全锥NAT)、解决“arp_cache: neighbor table overflow!”的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!