kslr
V2EX  ›  问与答

Iptables 设置针对某个 IP 不进行端口转发?

  •  
  •   kslr · Mar 1, 2015 · 2380 views
    This topic created in 4280 days ago, the information mentioned may be changed or developed.

    我在Iptables上设置了53端口转发到1053端口,但是针对某几个IP希望仍然使用53端口,请问这该如何实现?

    3 replies  •  2015-03-01 23:10:24 +08:00
    icloudnet
    icloudnet
    Mar 1, 2015
    1
    iptables -A INPUT -p tcp -s 你的IP --dport 53 -m state --state NEW,ESTABLISHED -j ACCEPT
    iptables -A OUTPUT -p tcp --sport 3306 -m state --state ESTABLISHED -j ACCEPT
    icloudnet
    icloudnet
    Mar 1, 2015
    2
    上面第二行的3306改成53 (ps:发出去就没法改,:):(:)
    extreme
    extreme
    Mar 1, 2015
    3
    是不是NAT表?
    如果是,就用RETURN。
    iptables -t nat -I PREROUTING -s 来源
    IP -p 协议 --dport 53 -j RETURN
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4445 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 07:11 · PVG 15:11 · LAX 23:11 · JFK 02:11
    ♥ Do have faith in what you're doing.