TCP keepalive状態モニタ

1693 ワード

#     TCP  
netstat -an | awk '/^tcp/ {++y[$NF]} END {for(w in y) print w, y[w]}'
#   keepalive     
sysctl -a | grep keepalive

#    (         )
net.ipv4.tcp_keepalive_time = 7200 #     
net.ipv4.tcp_keepalive_probes = 9  #     
net.ipv4.tcp_keepalive_intvl = 75  #     

#     
sysctl -w net.ipv4.tcp_keepalive_time=1800
echo 1800 >/proc/sys/net/ipv4/tcp_keepalive_time #     

永続的に有効にするには
vim /etc/sysctl.conf 

#       
net.ipv4.tcp_keepalive_time = 1800 
net.ipv4.tcp_keepalive_probes = 3 
net.ipv4.tcp_keepalive_intvl = 30

編集完了/etc/sysctl.conf、networkを再起動しないと有効になりません
#     
/etc/rc.d/init.d/network restart 

service network restart