kernel: ip_conntrack: table full, dropping packet.

来源:互联网 发布:华网网络电子备课系统 编辑:程序博客网 时间:2024/04/29 19:40

今天有台下载服务器出问题,丢包很严重,重启后看系统日志,很多“kernel: ip_conntrack: table full, dropping packet.” 

网上搜索了一下,用hping解决

下载hping:
http://www.hping.org/download.html

./configure
make
make install

安装后写一个script:

代码:

#!/bin/bash

echo
echo "############################"
echo "# Edit by Youngh 2003.06.24 v1.1 "
echo "# Usage : clr_conns IpAddress"
echo "# This will clear all connections from this IP_Address"
echo "# Example:/root/clr_conns 10.0.3.3 "
echo "############################"
echo

if [ -z $1 ] ; then
exit
fi

grep -E "^tcp .{10,25}ESTABLISHED src=$1 " /proc/net/ip_conntrack | while read line ; do
S_IP=`echo $line | awk '{print substr($5,5)}'`
S_SOCK=`echo $line | awk '{print substr($7,7)}'`
D_IP=`echo $line | awk '{print substr($6,5)}'`
D_SOCK=`echo $line | awk '{print substr($8,7)}'`
echo "$S_IP:$S_SOCK $D_IP:$D_SOCK"

hping2 $D_IP -R -s $S_SOCK -p $D_SOCK -a $S_IP -k -c 1 >/dev/null 2>/dev/null &

done

保存为clr_conns.sh

用:

sh clr_conns.sh x.x.x.x

就可以清除显示的连接.

摘自:中国Linux论坛

 

查看ip_conntrack前几位IP

cat /proc/net/ip_conntrack | cut -d ' ' -f 10 | cut -d '=' -f 2 | sort | uniq -c | sort -nr | head -n 5

原创粉丝点击