欢迎来到山村网

linux中 iptables遇到iptables: Protocol wrong type for socket

2019-03-09 14:14:07浏览:685 来源:山村网   
核心摘要:下面琰各位介绍一篇关于Linode vps iptables遇到iptables: Protocol wrong type for socket.错误的解决方法,希望文章对各位有帮

下面琰各位介绍一篇关于Linode vps iptables遇到iptables: Protocol wrong type for socket.错误的解决方法,希望文章对各位有帮助


想在linode vpscentos 6.4上iptables加入限制ip连接数不能超过100的规则:
iptables -A INPUT -p tcp --syn --dport 80 -m connlimit --connlimit-above 100 -j REJECT

出现错误:

iptables: Protocol wrong type for socket.

问过Linode客服,说是内核与connlimit模块不兼容,iptables版本太旧了,需要升级。
查看iptables版本:

[root@linode ~]# iptables -V
iptables v1.4.7

查看iptables安装包:

[root@linode ~]# rpm -qa | grep iptables
iptables-1.4.7-9.el6.x86_64
iptables-ipv6-1.4.7-9.el6.x86_64

按以下方法解决问题,但注意iptables再也不能使用yum来管理:

yum update
rpm -e --nodeps iptables-1.4.7-9.el6.x86_64
rpm -e --nodeps iptables-ipv6-1.4.7-9.el6.x86_64
yum groupinstall 'Development Tools'
wget http://www.netfilter.org/projects/iptables/files/iptables-1.4.19.tar.bz2
tar jxf iptables-1.4.19.tar.bz2
cd iptables-1.4.19
LDFLAGS="-L$PWD/libiptc/.libs" ./configure --prefix=/usr --exec-prefix= --bindir=/usr/bin --with-xtlibdir=/lib/xtables --with-pkgconfigdir=/usr/lib/pkgconfig --enable-libipq --enable-devel
make
make install

查看iptables版本:

[root@linode ~]# iptables -V
iptables v1.4.19

[root@linode iptables-1.4.19]# iptables -A INPUT -p tcp --syn --dport 80 -m connlimit --connlimit-above 100 -j REJECT
[root@linode iptables-1.4.19]# iptables -L
Chain INPUT (policy ACCEPT)
REJECT tcp -- anywhere anywhere tcp dpt:http flags:FIN,SYN,RST,ACK/SYN #conn src/32 > 100 reject-with icmp-port-unreachable

可以看到上面已经有一条规则了。

(责任编辑:豆豆)
下一篇:

nginx安装文件上传ngx_upload模块教程

上一篇:

Linux中svn提交文件后自动同步更新到网站目录

  • 信息二维码

    手机看新闻

  • 分享到
打赏
免责声明
• 
本文仅代表作者个人观点,本站未对其内容进行核实,请读者仅做参考,如若文中涉及有违公德、触犯法律的内容,一经发现,立即删除,作者需自行承担相应责任。涉及到版权或其他问题,请及时联系我们 xfptx@outlook.com