熱搜:win11繞過硬件限制安裝 一鍵重裝Win10系統(tǒng) 最干凈的u盤啟動盤 真正純凈版的win7系統(tǒng)
時間:2015-06-05 16:39:59 作者:qipeng 來源:系統(tǒng)之家 1. 掃描二維碼隨時看資訊 2. 請使用手機瀏覽器訪問: https://m.xitongzhijia.net/xtjc/20150605/50205.html 手機查看 評論 反饋
Linux系統(tǒng)中,iptables有利于Linux防火墻的配置,能夠控制ip信息包過濾,可有用戶遇到了iptables: Protocol wrong type for socket.錯誤,不知是由什么原因引起的,下面小編就給大家介紹下Linux系統(tǒng)iptables出現(xiàn)該報錯的解決方法。
想在linode vps centos 6.4上iptables加入限制ip連接數不能超過100的規(guī)則:
iptables -A INPUT -p tcp --syn --dport 80 -m connlimit --connlimit-above 100 -j REJECT
出現(xiàn)錯誤:
iptables: Protocol wrong type for socket.
問過Linode客服,說是內核與connlimit模塊不兼容,iptables版本太舊了,需要升級。
查看iptables版本:
。踨oot@linode ~]# iptables -V
iptables v1.4.7
查看iptables安裝包:
。踨oot@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 https://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版本:
。踨oot@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
。踨oot@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
可以看到上面已經有一條規(guī)則了。
上面就是Linux系統(tǒng)下iptables報錯iptables: Protocol wrong type for socket的解決方法介紹了,主要是iptables版本太低所導致,因進行升級。
發(fā)表評論
共0條
評論就這些咯,讓大家也知道你的獨特見解
立即評論以上留言僅代表用戶個人觀點,不代表系統(tǒng)之家立場