imshawer
V2EX  ›  SSH

请教一个 CentOS 下防火墙开启后 SSH 不能动态转发的问题

  •  
  •   imshawer · Oct 1, 2012 · 3779 views
    This topic created in 4998 days ago, the information mentioned may be changed or developed.
    防火墙如下设置后发现 SSH 就不能动态转发了,请教一下是否是因为某个端口或者协议没有打开?

    Chain INPUT (policy DROP)
    target prot opt source destination
    ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
    ACCEPT ah -- anywhere anywhere
    ACCEPT esp -- anywhere anywhere

    Chain FORWARD (policy ACCEPT)
    target prot opt source destination

    Chain OUTPUT (policy ACCEPT)
    target prot opt source destination
    1 replies    1970-01-01 08:00:00 +08:00
    imshawer
        1
    imshawer  
    OP
       Oct 1, 2012
    应该是解决了,需要再加入以下的规则:

    iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

    表示其他端口必须是 ESTABLISHED、RELATED 这两种状态的数据包才能通过。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1136 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 18:18 · PVG 02:18 · LAX 11:18 · JFK 14:18
    ♥ Do have faith in what you're doing.