Linux system iptables error iptables: Protocol wrong how to do?

  

Linux system, iptables is conducive to the configuration of Linux firewall, can control ip packet filtering, some users have encountered iptables: Protocol wrong type for socket. Error, I do not know what caused it, the following small series Let me introduce the solution to the error in the Linux system iptables.

on the wanted linode vps centos 6.4 iptables added limiting the number of connections can not exceed 100 ip rule:

iptables -A INPUT -p tcp --syn --dport 80 -m Connlimit --connlimit-above 100 -j REJECT

Error:

iptables: Protocol wrong type for socket.

Asked Linode customer service, said kernel and connlimit module Incompatible, the iptables version is too old and needs to be upgraded.

View iptables version:

[root@linode ~]# iptables -V

iptables v1.4.7

View iptables installation package:

[root@linode ~]# rpm -qa |  Grep iptables

iptables-1.4.7-9.el6.x86_64

iptables-ipv6-1.4.7-9.el6.x86_64

Solve the problem as follows: But note that iptables can no longer be managed with 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=&ldquo ;-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

View iptables version:

[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

You can see that there is already a rule above.

The above is the Linux system iptables error iptables: Protocol wrong type for socket solution introduced, mainly because the iptables version is too low, due to upgrade.

Copyright © Windows knowledge All Rights Reserved