0
点赞
收藏
分享

微信扫一扫

ARP cache溢出

舍予兄 2021-09-28 阅读 105
技术文章

一、如何判断 arp_cache 溢出?

内核日志会有有下面的报错:

arp_cache: neighbor table overflow!

查看当前 arp 记录数:

$ arp -an | wc -l
1335

查看 arp gc 阀值

$ sysctl -a | grep gc_thresh
net.ipv4.neigh.default.gc_thresh1 = 128
net.ipv4.neigh.default.gc_thresh2 = 512
net.ipv4.neigh.default.gc_thresh3 = 1024
net.ipv6.neigh.default.gc_thresh1 = 128
net.ipv6.neigh.default.gc_thresh2 = 512
net.ipv6.neigh.default.gc_thresh3 = 1024

当前 arp 记录数接近 gc_thresh3 比较容易 overflow,因为当 arp 记录达到 gc_thresh3 时会强制触发 gc 清理,当这时又有数据包要发送,并且根据目的 IP 在 arp cache 中没找到 mac 地址,这时会判断当前 arp cache 记录数加 1 是否大于 gc_thresh3,如果没有大于就会 时就会报错: arp_cache: neighbor table overflow!

二、解决方案

调整节点内核参数,将 arp cache 的 gc 阀值调高 (/etc/sysctl.conf):

net.ipv4.neigh.default.gc_thresh1 = 80000
net.ipv4.neigh.default.gc_thresh2 = 90000
net.ipv4.neigh.default.gc_thresh3 = 100000

sysctl -p使其生效

举报

相关推荐

0 条评论