jarell
V2EX  ›  问与答

请教一下这条 iptables 规则用 nftables 怎么写呢?

  •  
  •   jarell · Jul 19, 2017 · 3081 views
    This topic created in 3397 days ago, the information mentioned may be changed or developed.
    iptables -t nat -A PREROUTING -d 192.168.99.0/24 -p tcp -j REDIRECT --to-ports 1234
    多谢
    4 replies  •  2022-08-24 23:40:39 +08:00
    jasontse
    jasontse
    Jul 19, 2017 via iPad
    1
    nft add rule nat prerouting daddr 192.168.99.0/24 tcp redirect to 1234

    你试试看吧
    jarell
    jarell
    OP
    Jul 19, 2017
    2
    @jasontse 显示下面这个
    <cmdline>:1:25-29: Error: syntax error, unexpected daddr
    add rule nat prerouting daddr 192.168.99.0/24 tcp redirect to 1234
    ^^^^^
    jarell
    jarell
    OP
    Jul 19, 2017
    3
    # nft add rule nat prerouting ip daddr 192.168.99.0/24 tcp redirect to 1234
    <cmdline>:1:54-61: Error: syntax error, unexpected redirect
    add rule nat prerouting ip daddr 192.168.99.0/24 tcp redirect to 1234
    gesse
    gesse
    Aug 24, 2022
    4
    root@xxx:~# iptables-translate -t nat -A PREROUTING -d 192.168.99.0/24 -p tcp -j REDIRECT --to-ports 1234
    nft add rule ip nat PREROUTING ip protocol tcp ip daddr 192.168.99.0/24 counter redirect to :1234

    PS: iptables-translate 需要 iptables 版本 1.8
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1119 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 23:52 · PVG 07:52 · LAX 15:52 · JFK 18:52
    ♥ Do have faith in what you're doing.