• 请不要在回答技术问题时复制粘贴 AI 生成的内容
maladroit
V2EX  ›  程序员

iptables 规则请教

  •  
  •   maladroit · Dec 3, 2020 · 2000 views
    This topic created in 2070 days ago, the information mentioned may be changed or developed.

    试图理解设置 tproxy 过程中这份文档里 iptables 规则的含义, https://lancellc.gitbook.io/clash/start-clash/clash-udp-tproxy-support

    这里想问末尾三句是什么意思?我理解最后一句 PREROUTING 是修改外来发往 53 端口的请求,转发到 1053 (本地 Clash DNS 端口);为什么需要倒数第二句 OUTPUT 呢?我理解 OUTPUT 应该是指 local 发生的发往 53 端口的请求,不知道理解对么…

    iptables -t nat -N CLASH_DNS
    iptables -t nat -F CLASH_DNS
    iptables -t nat -A CLASH_DNS -p udp -j REDIRECT --to-port 1053
    iptables -t nat -I OUTPUT -p udp --dport 53 -j CLASH_DNS
    iptables -t nat -I PREROUTING -p udp --dport 53 -j REDIRECT --to 1053
    
    2 replies    2020-12-04 00:20:50 +08:00
    XiaoxiaoPu
        1
    XiaoxiaoPu  
       Dec 4, 2020
    OUTPUT: 由本机产生,向外转发
    PREROUTING 是转发的包(数据包来自其他主机)

    blog.51cto.com/wushank/1171768
    johry
        2
    johry  
       Dec 4, 2020
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5370 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 08:07 · PVG 16:07 · LAX 01:07 · JFK 04:07
    ♥ Do have faith in what you're doing.