티스토리 뷰

os/Linux

print net_ratelimit in the message

Jacob_baek 2022. 2. 15. 21:18

현상

아래와 같은 message log 출력과 함께 ssh 연결이 간헐적으로 연결되지 않는 현상발생

Feb 14 17:30:07 ubuntu-instance kernel: net_ratelimit: 27 callbacks suppressed
Feb 14 17:30:33 ubuntu-instance kernel: net_ratelimit: 10 callbacks suppressed

혹은 syslog에 다음과 같은 메세지가 출력될수도 있다.
Neighbour table overflow

원인

다수의 arp table이 생기는 가상화 환경에서 발생될수 있는 문제로
기본적으로 아래와 같은 gc_thresh value를 가지고 있어 그 이상이 생길경우 문제가 발생된다.

root@ubuntu-instance:/home/ubuntu# 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

해결방법

아래와 같은 sysctl 설정을 추가하여

root@ubuntu-instance:/home/ubuntu# cat /etc/sysctl.d/99-gcthresh.conf
net.ipv4.neigh.default.gc_thresh1 = 1024
net.ipv4.neigh.default.gc_thresh2 = 4096
net.ipv4.neigh.default.gc_thresh3 = 8192
root@ubuntu-instance:/home/ubuntu#

아래와 같은 명령으로 적용한다.

root@ubuntu-instance:/home/ubuntu# sysctl --system
* Applying /etc/sysctl.d/10-console-messages.conf ...
kernel.printk = 4 4 1 7
* Applying /etc/sysctl.d/10-ipv6-privacy.conf ...
net.ipv6.conf.all.use_tempaddr = 2
net.ipv6.conf.default.use_tempaddr = 2
* Applying /etc/sysctl.d/10-kernel-hardening.conf ...
kernel.kptr_restrict = 1
* Applying /etc/sysctl.d/10-link-restrictions.conf ...
fs.protected_hardlinks = 1
fs.protected_symlinks = 1
...

gc_thresh의 의미
gc_thresh1 : 만약 이 숫자보다 작은 경우 garbage collector는 entre들을 제거하지 않는다. (default : 128)
gc_thresh2 : 해당 수치를 넘어서면 garbage collector는 5초보다 오래된 항목을 지운다. (default : 512)
gc_thresh3 : 해당 수치를 넘어서면 garbage collector는 즉시 지운다. (default : 1024)

참고용

참고사이트

'os > Linux' 카테고리의 다른 글

Ubuntu ringbuffer size permanent changing  (0) 2022.08.09
nftables  (0) 2022.08.09
process max open files with systemd  (0) 2021.11.24
How to occur hung_task_panic on Rocky Linux  (0) 2021.11.03
Ubuntu CVE Status  (0) 2021.03.17
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함