iptables: Protocol wrong type for socket. - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
orzfly
V2EX    Linux

iptables: Protocol wrong type for socket.

< href="Javascript:" Onclick="upVoteTopic(71508);" class="vote">
  •  
  •   orzfly
    orzFly 2013-06-06 19:35:25 +08:00 6213 次点击
    这是一个创建于 4588 天前的主题,其中的信息可能已经有所发展或是发生改变。
    于是想给centOS6服务器加点安全措施于是打算限制连接数可是……

    # iptables -I FORWARD -p tcp --syn --dport 80 - m connlimit --connlimit-above 20 -j DROP
    iptables: Protocol wrong type for socket.

    语法明显没错...
    但是为啥会有这么奇葩的提示啊=A=
    1 条回复    1970-01-01 08:00:00 +08:00
    Sonic1997
        1
    Sonic1997  
       2013-06-07 09:10:11 +08:00
    麻烦叔发帖了...

    CentOS's userspace tools are also incompatible with the connlimit module in our latest 3.x series kernels because the version of 'iptables' that is installed is too old:
    //CentOS的用户空间工具在我们最新的3.x系列核心中与connlimit模块不兼容因为所安装的iptables版本太旧了:
    -----
    # iptables -V
    iptables v1.4.7
    -----

    Please issue these commands, and again, remember that building from source means that this package will no longer be managed by your package management system (yum):
    //输入以下指令,后面的懒得翻译,注意这会覆盖掉你的东西就行了
    yum update
    rpm -e --nodeps iptables-1.4.7-9.el6.i686
    rpm -e --nodeps iptables-ipv6-1.4.7-9.el6.i686
    yum groupinstall 'Development Tools'
    wget http://www.netfilter.org/projects/iptables/files/iptables-1.4.19.tar.bz2
    tar jxvf 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

    When the installation is complete, run "iptables -V" and you should see the following output:
    //当你完成安装时,输入“iptables -V” 然后你会看到下面的内容
    -----
    iptables v1.4.19
    -----

    Now try to load that iptables rule:
    //现在你可以用了

    iptables -I FORWARD -p tcp --syn --dport 80 -m connlimit --connlimit-above 20 -j DROP

    It should succeed with no error message. You can verify that the rule was loaded with either of these commands:
    //下载应该能运行的了,你可以通过以下任意一个指令来验证你的规矩是否已经加载

    iptables-save
    iptables -L -n -v





    搞定,感谢Linode客服
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     5403 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 27ms UTC 07:54 PVG 15:54 LAX 23:54 JFK 02:54
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86