Linux系统iptables报错iptables: Protocol wrong怎么办?

  Linux系统中,iptables有利于Linux防火墙的配置,能够控制ip信息包过滤,可有用户遇到了iptables: Protocol wrong type for socket.错误,不知是由什么原因引起的,下面小编就给大家介绍下Linux系统iptables出现该报错的解决方法。

  想在linode vps centos 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

  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

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

  上面就是Linux系统下iptables报错iptables: Protocol wrong type for socket的解决方法介绍了,主要是iptables版本太低所导致,因进行升级。

每天告诉自己一次,『我真的很不错』

Linux系统iptables报错iptables: Protocol wrong怎么办?

相关文章:

你感兴趣的文章:

标签云: