V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
treedon
V2EX  ›  Linux

[急!!!]打开 3306 端口 遇到 Index of insertion too big!

  •  
  •   treedon · 2017-11-20 14:04:19 +08:00 · 13264 次点击
    这是一个创建于 2320 天前的主题,其中的信息可能已经有所发展或是发生改变。
    百度,谷歌这个报错 都没什么答案..
    我的环境是用 oneinstack 集成包装的, 想设置 mysql 允许远程连接
    然后找到了这个文章 https://oneinstack.com/question/298/
    BUT.
    我一执行 iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
    就会提示 iptables: Index of insertion too big.
    咋办啊,网上找了好久 没找到解决方案
    mysql 本机连接没问题, 外部连接不了现在
    13 条回复    2017-11-20 23:23:41 +08:00
    hcymk2
        1
    hcymk2  
       2017-11-20 14:15:34 +08:00
    iptables -I
    iptables -A
    treedon
        2
    treedon  
    OP
       2017-11-20 14:22:43 +08:00
    @hcymk2 这两个命令都没哦
    我的是 contos6.5
    gouchaoer
        3
    gouchaoer  
       2017-11-20 14:44:11 +08:00
    chkconfig 里面关闭 iptables
    然后停掉 iptables 服务,over
    hcymk2
        4
    hcymk2  
       2017-11-20 15:00:12 +08:00
    @treedon
    iptables --line-numbers -L INPUT
    看下你有多少行规则。
    jasonyang9
        5
    jasonyang9  
       2017-11-20 15:05:07 +08:00
    把 4 去掉大概就可以了
    raysonx
        6
    raysonx  
       2017-11-20 15:09:08 +08:00 via Android
    你知道-I 后面那个 4 是什么意思吗?
    网上的文章给你一条 rm -rf /你也敢输入对吧
    hugee
        7
    hugee  
       2017-11-20 15:13:08 +08:00 via Android
    oneinstack 大而杂,比较垃圾。
    tempdban
        8
    tempdban  
       2017-11-20 15:15:15 +08:00
    @gouchaoer oneinstack 的安全组用的是 iptables,你知道关了有啥影响么?
    动一动脑,多学学,别没事就喷着喷那的。
    tempdban
        9
    tempdban  
       2017-11-20 15:20:06 +08:00
    @gouchaoer 对不起,我这自己打脸了,我以为是 onestack,抱歉
    treedon
        10
    treedon  
    OP
       2017-11-20 15:51:10 +08:00
    @hcymk2 四条规则
    treedon
        11
    treedon  
    OP
       2017-11-20 15:51:22 +08:00
    @gouchaoer 关掉会不会出啥事啊?
    sublimevsatom
        12
    sublimevsatom  
       2017-11-20 18:40:56 +08:00
    楼上有同学说了,
    根据提示来,
    iptables: Index of insertion too big.
    说明你 insert 的这个 4 的位置并不存在, 具体你可以看一下--line-numbers。

    所以
    iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
    应该是可以的。
    wqtacc
        13
    wqtacc  
       2017-11-20 23:23:41 +08:00
    你应该没有 4 这个位置吧,这个错误大概是命令向第 4 行插入,结果超过了 INPUT 行号;
    试试插入到开始位置:
    iptables -I INPUT 1 -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
    PS. mysql 远程访问先考虑是不是 mysql 的用户权限开放了远程客户端登录。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5255 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 09:36 · PVG 17:36 · LAX 02:36 · JFK 05:36
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.