Iptables tproxy on ip 0/16, 240. 1的2017端口,但是这里有一个问题,虽然我们在iptables中设置了该动作,但是,数据包仍然会经过路由表的处理。 本配置参考了TProxy 透明代理的新 V2Ray 白话文教程,透明代理(TProxy)配置教程以及透明代理通过 gid 规避 Xray 流量,加入了透明代理对 ipv6 的支持,并且使用 VLESS-TCP-XTLS-RPRX-Vision 方案对抗封锁 (推荐使用 1. /iptables. 0 dev eth1 ip address add 0. 0/4 -j RETURN iptables -t mangle -A V2RAY_MASK -d 255. 0。 I'd like to set up a configuration where one Docker container hosts a proxy router with tproxy feature (like Clash, Clash. 2) I get timeouts, seeing the Wireshark logs, any packet is #iptables opkg update opkg install bash iptables dnsmasq-full curl ca-bundle ipset ip-full iptables-mod-tproxy iptables-mod-extra ruby ruby-yaml kmod-tun kmod-inet-diag unzip luci-compat luci luci-base opkg install 起源. For building instructions, or redirect traffic with destination IP 10. 1) and connect? PS. In the examples that follow, we will use 2500 as the listening port for TProxy. conf && sysctl -p -A clash -m set --match-set clashhost src -j RETURN iptables -t mangle -A clash -p tcp -j TPROXY --on-port 7893 --tproxy-mark 1 iptables -t mangle -A clash -p udp -j TPROXY --on-port 7893 --tproxy-mark 1 iptables -t mangle -A clash -p tcp -j RETURN -m mark 然后设定 UDP 流量透明代理的 iptables 规则,命令如下. For more information please 注意安装相应程序 # sudo apt install iptables ip6tables 或 # sudo apt install nftables udp } meta mark set 0x00000001 tproxy ip to 127. 254. 1 --on-port 1088 --tproxy-mark 1088 When I try to curl any IP in the virtual machine side (192. 文章浏览阅读2. Running TProxy. ) Adding the iptables rule makes it possible for the proxy application (tpcrdr in our case) to receive packets with the destination port other than what the listening socket is bound to. 代理应用程序通过某些方式获取原始目标的IP地址和port等信息 最后根据需求 文章浏览阅读1. 2 及之后 nftables 配置与 iptables 0. 2 从零开始一步步实现基于 iptables-tproxy 的透明代理 在开始之前,你需要有一定的基础知识: 大概知道什么是 TCP/IP 协议、域名和 DNS 服务器. XGFan 2012-2025 ss-tproxy 主机上都正常,但其他主机上,黑名单正常,白名单不正常(如百度无法访问)。请将 ipts_set_snat(IPv4)、ipts_set_snat6(IPv6)设为 true。并检查 ss-tproxy 主机的 iptables 规则,有些系统会将 FORWARD 链的默认策略设为 DROP,如果有这种情况,请进行合理的调整,如果不知道怎么设置,可以参照下面 TCP/UDP transparent proxy with predefined bypass address set, using nftables `tproxy` target. This demo owns much thanks to go-tproxy[1]. 首先需要实现流量拦截:在 iptables 的 PREROUTING 链的 mangle 表中创建一个规则,拦截流量发送给 tproxy 处理,例如 iptables -t mangle -A PREROUTING -p tcp -dport 9080 -j TPROXY --on-port 15001 --on-ip _iptables tproxy. 0/8 -j RETURN 最近正在尝试将主力笔记本从 Mac 换到 Linux,首先要解决的就是网络问题 ~(桌面美化)~。本文介绍了笔者在使用 Linux 内核支持的 tproxy(Transparent proxy)让本机(手里的笔记本)访问外网流量时通过 tproxy 完成,同时本机在家里内网环境时访问内网流量不经过 tproxy,在其他环境下,访问的家里内网 To use it, enable the socket match and the TPROXY target in your kernel config. 10. Closed deeptuuk opened this issue Dec 22, 2018 · 9 comments Closed missing iptables-mod-tproxy or ip #217. iptables -t mangle -A PREROUTING -p tcp --dport 5000 -j TPROXY --tproxy-mark 0x1/0x1 --on-port 4000 I simply want to redirect all traffic going with destination port 5000 to port 4000. 在 Istio 最新的 Ambient 模式 中,使用了 tproxy 做透明流量劫持(见此博客 ),这与 Sidecar 模式 中基于 IPtables 的流量劫持方式有些许不同,这篇文文章,我们就就一起来探究下什么是 tproxy。. Wiki; 注意事项. 0/16 -p udp -j RETURN # 直连局域网 iptables -t iptables: a very common network tool that directly supports TProxy nftables is a framework developed by the Netfilter project team, mainly used for packet filtering, NAT and other packet modification operations, however, this tool is mainly used in Debian, it is used in Debain instead of iptables. 1 SRC_IP=192. For more information please . The standard iptables REDIRECT is not usable in my case, as it alters the packet and changes the original destination port. Am I missing something or raw socket cannot receive data in level TPROXY works? iptables -A PREROUTING -t mangle -p udp --dport 8816 --dst 127. 知道什么是 WAN 口,LAN 口,LAN_IP,WAN_IP 以及 DHCP 服务器。对于旁路由,只 table inet clash delete table inet clash table inet clash { set local_addr { type ipv4_addr flags interval elements = { 10. 0/0 dev lo table 100 #Setup a chain DIVERT to mark packets iptables -t mangle -N DIVERT iptables -t mangle -A DIVERT -j MARK --set-mark 1 iptables -t mangle -A DIVERT -j ACCEPT #Use DIVERT to prevent existing connections going through TPROXY twice: iptables -t mangle -A PREROUTING -p tcp ip rule add fwmark 0x2333/0x2333 pref 100 table 100 ip route add local default dev lo table 100 iptables -t mangle -A PREROUTING -p udp -j TPROXY --tproxy-mark 0x2333/0x2333 --on-ip 127. # tproxy 7893(clash) 端口,并打上 mark 666 命中策略,走 666 路由表 iptables -t mangle -A clash -p tcp -j TPROXY --on-port 7893 --tproxy-mark 666 iptables -t mangle -A clash -p udp -j TPROXY --on-port 7893 --tproxy tproxy_Iptables+Tproxy 先来简单说下透明代理的大体流程:1. . sh ---🟢iptables config file ├── update-config. Here is how: first we create a new routing table echo "10 tproxy" >> /etc/iproute2/rt_tables then we add new routing rule ip rule add from <your_ip_address> table tproxy then we add a new defaut route ip route add default via <your_default_gateway> dev eth0 table tproxy finaly we modify TPROXY rule to only match traffic that is not originating 然后我们从这两个观点很容易得出一个推论:无法在提供透明代理的本机(即本例中的网关)上对 udp 透明代理。这个结论好像并没有什么问题,对吧?但实际上,在本例的配置中无论是 tcp 还是 udp,都可以实现在本机上的透明代理,而且都是用 tproxy。 # ip rule add fwmark 1 lookup 100 # ip route add local 0. For more information please First, you need to implement traffic interception: create a rule in the mangle table of the PREROUTING chain of iptables to intercept traffic and send it to tproxy for processing, for example, iptables -t mangle -A 利用iptables TPROXY target,可以在skb进入到协议栈之前,将skb关联到一个本地监听的socket,并且设置skb的fwmark。可以利用fwmark配置高级路由功能将非本地流量送到本地lo interface,从而能进入本地协议栈的处理。skb随后通过ip_rcv进入本地协议 First, you need to implement traffic interception: create a rule in the mangle table of the PREROUTING chain of iptables to intercept traffic and send it to tproxy for processing, for example, iptables -t mangle -A PREROUTING -p tcp -dport iptables -t mangle -A PREROUTING -i eth1 -p tcp -m multiport --dport 80,443 -j TPROXY --on-ip 0. IP_TRANSPARENT 是一个 Linux 中的 socket 选项, 主要用于实现透明代理功能,它具有以下两个关键作用: 接收 TPROXY 重定向的连接:允许应用程序接收通过 iptables TPROXY 规则重定 文章浏览阅读3. 3 EXT_PORT=80 INT_PORT=54321 # Bring interfaces to bridge down ip link set dev eth1 down ip link set dev eth2 down # Remove any ip addresses on the interfaces ip address flush dev eth1 ip address flush dev eth2 ip address add 0. - rocka/nft-transproxy iptables redirect tproxy test. 33-beta Bug on Environment Official OpenWrt 静态 IP 配置, 网关设备 IP 必须是固定的; 使用 Firewalld 管理 Netfilter (本文不直接使用 iptables 或 nftables) 了解基础的 TCP/IP 知识 (如 TCP/IP、DNS、NAT、路由) 能手动编辑 V2Ray JSON 配置文件 (至少能看懂配置逻辑) 有解决问题的能力, 遇到问题时能自行根据实际情况 发布时间. 用例 1:配合透明代理使用(如 ss-tproxy),为那些只支 INT_IP=169. The kernel will mark those packets with the number 1. 45. ip rule add fwmark 1 table 100 ip route add local 0. Contribute to xyyangkun/ip_redirect_tproxy development by creating an account on GitHub. ip_forward = 1" >> /etc/sysctl. 1:12345 accept meta l4proto { tcp, udp } meta mark set 0x00000001 tproxy ip6 to [::1]:12345 accept } chain output { type route hook output priority filter; 从零开始一步步实现基于 iptables-tproxy 的透明代理 在开始之前,你需要有一定的基础知识: 大概知道什么是 TCP/IP 协议、域名和 DNS 服务器. 拿 ip 命令对比测试: echo "net. 3 enable 3. 0/8, 127. 0/16 -p tcp -j RETURN # 直连局域网 iptables -t mangle -A V2RAY_MASK -d 192. mangle表. 3 TCP转址机3、socket透明代理的实现原理?4、在实现TCP代理服务器时,遵循以下几点原则5、应用背景6、关键技术? IPTables TPROXY - proxy input and output. 0/0 dev lo table 100 sudo ip rule add fwmark 1 table 100 sudo iptables -t mangle -N SSUDP sudo iptables -t mangle -A SSUDP -d 0. 0/0 dev lo table 100 -linux-netfilter’ to configure and set the ‘tproxy’ option on the HTTP listener you redirect traffic to with the TPROXY iptables target. 1、TPROXY是什么. Feel free to use a different port if you wish. open an UDP socket, bind it to 0. # Проксирование устройств локальной сети # Наследуем достижения предыдущего этапа ip rule add fwmark 1 table 100 ip route add local 0. 你可能听说过TPROXY,它通常配合负载均衡软件HAPrxoy或者缓存软件Squid使用。 在所有"Proxy"类型的应用中都一个共同的问题,就是后端的目标服务器上看到的连接的Source IP都不再是用户原始的IP,而是前端的"Proxy"服务器的IP。. # ip rule add fwmark 1 lookup 100 # ip route add local 0. 0/16, 172. 0/12, 192. 网关通过设置iptables、ip路由策略方式将感兴趣的流量截获并重定向代理应用程序3. : I don't know if TPROXY was designed to work with non-local assuming eth0 as external and eth1 as internal (lan, 192. sh address dst 10. 123. 2k次。本文深入探讨了iptables的TPROXY目标在内核中的实现,包括如何通过mangle表的PREROUTING链进行报文标记、IP路由策略的设定,以及TPROXY目标的检查和处理函数。详细阐述了TCP和UDP协议下如何寻找和处理套接口,特别提到了TIME_WAIT状态的TCP套接口处理。 TProxy's binaries can be downloaded from the latest release or can be built from the source code. ipv4. # _tcp proxy 透传ip地址 Verify Steps Tracker 我已经在 Issue Tracker 中找过我要提出的问题 Latest 我已经使用最新 Dev 版本测试过,问题依旧存在 Core 这是 OpenClash 存在的问题,并非我所使用的 Clash 或 Meta 等内核的特定问题 Meaningful 我提交的不是无意义的 催促更新或修复 请求 OpenClash Version v0. You can To use it, pass ‘--enable-linux-netfilter’ to configure and set the ‘tproxy’ option on the HTTP listener you redirect traffic to with the TPROXY iptables target. 1w次,点赞8次,收藏59次。目录:1、什么是透明代理?2、透明代理的作用?2. It will be a different, but working, setup. 0 or to a more specific IP; you enable IP_RECVORIGDST via setsockopt(fd, SOL_IP, IP_RECVORIGDSTADDR, ) you use recvmsg() instead of recvfrom()/recv() to receive frames; recvmsg() will return the packet and a series of ancillary I intend using iptables' TPROXY target to redirect some UDP packets to a raw socket, but no packet would received by socket. 0/16 -j RETURN iptables -t mangle -A V2RAY_MASK -p udp -j TPROXY --on-port 12345 --tproxy-mark 1 iptables -t mangle -A iptables redirect tproxy test. GitHub Gist: instantly share code, notes, and snippets. All other iptables-mechanisms like any NAT, MASQUERADE, REDIRECT rewrite the IP addresses of the packet, which makes it impossible to find out where the packet originally was intended to. 0/16 udp dport != 53 return ip protocol tcp tproxy to 127. 3: $ . 2. It work with UDP sockets. 0/0 dev lo table 100 iptables -t mangle -N XRAY iptables -t mangle -A XRAY -d Сегмент сети шлюза 1-j RETURN iptables -t mangle -A XRAY -d Сегмент сети шлюза # ip rule add fwmark 1 lookup 100 # ip route add local 0. 2024-12-31 18:10 GMT+0800; 使用手册. 执行了以上 ip 和 iptables 命令后,局域网同网段的设备以及网关本身就可以直接翻墙了。 关于 iptables 规则,比较容易理解,如果不太理解的话也可以 Google 搜索其他相关文章资料对比学习。在类 ss-redir 透明代理中,有两个观点非常深入人心: 1. 2 --on-ip 192. 9k次。本文介绍了透明代理的基本流程,并详细探讨了iptables+redirect和iptables+tproxy两种流量转发方案,特别是tproxy在处理UDP协议时的优势。通过示例代码展示了如何使用iptables规则和RedSocks实现TCP与UDP的透明代理,同时解释了如何获取原始目标地址和端口信息。 # ROUTE RULES ip rule add fwmark 1 table 100 ip route add local 0. 0/24 -j ACCEPT iptables -t mangle -A I used ip to define a route for policy routing based on the mark I set up with iptables: ip rule add fwmark 1/1 Руководство по настройке прозрачного проксирования TProxy (ipv4 и ipv6) Эта конфигурация основана на Новом руководстве по V2Ray на русском языке - Прозрачное проксирование (TPROXY) Открыть в новой вкладке, Руководстве по Xu’s Log. 10): iptables --table nat --append PREROUTING --in-interface eth0 --source !10. service ---🟢systemd unit file to start up clash ├── clean. 0/4, 0. 用户将流量发送的网关服务器2. 0/0 -linux-netfilter’ to configure and set the ‘tproxy’ option on the HTTP listener you redirect traffic to with the TPROXY iptables target. 1:12345 meta mark set 1 } chain output { type route hook output sudo iptables -t mangle -A PREROUTING -i eth0 -p tcp --dport 80 -m tcp -j TPROXY --on-ip 192. Also application-level support is necessary, the -t flag sets the IP_TRANSPARENT option on the listening ip rule add fwmark 1 lookup 100 ip route add local 0. You will need policy routing too, so be sure to # ip rule add fwmark 1 lookup 100 # ip route add local 0. By removing -p tcp -m socket TPROXY will affect all IP (v4) packets. ini ---🟢config file for subconverter ├── iptables. The steps are found in the TPROXY-documentation. 7k次。本文详细解析了透明代理的工作原理,包括客户端与真实服务器之间的连接过程,以及如何通过本地socket捕获数据包、使用iptables的nat和tproxy方式来实现透明代理。文中还介绍了为socket设置IP_TRANSPARENT选项的方法。 ip rule add fwmark 1088 table 100 ip route add local default dev virbr0 table 100 iptables -t mangle -A PREROUTING -i virbr0 -p tcp -j TPROXY -s 192. 5k次。Introduction tcp透明代理,只是测试demo。 With the support of linux kernal, a proxy on a router can intercept tcp traffic and sends the packet to destination by enble IP_TRANSPARENT. Meta, Xray or v2ray) and the others Docker containers send traffic to In our case, we want TProxy to capture HTTPS traffic between 10. 今天看到有网文《iptables+tproxy实现ss-redir的UDP转发的方法》说:“OpenWrt 做 UDP 转发需要的依赖是:iptables-mod-tproxy, kmod-ipt-tproxy 和 ip-full”。 使用 opkg install ip 安装的默认是 ip-tiny,一般情况下都是够用的,不禁想弄明白两者有何区别。. 0/4 -j RETURN # FORWARD ALL iptables -t 要使用iptables的tproxy命令进行转发至指定IP和端口,可以按照以下步骤操作:确保你的系统已经加载了nf_tproxy_core和nf_tproxy_ipv4内核模块。如果没有加载,请先加载这两个模块。创建一个新的ip 旧版本基于iptables的Firewall3防火墙 #iptables opkg update opkg install coreutils-nohup bash iptables dnsmasq-full curl ca-certificates ipset ip-full iptables-mod-tproxy iptables-mod-extra libcap libcap-bin ruby ruby-yaml kmod Edited: to add how to query UDP destination addresses with TProxy. The only required steps are the routing and the TPROXY iptables-rule, the DIVERT-rule is an optimisation to prevent unnecessary processing of packets in the TPROXY target (-m socket # ip rule add fwmark 1 lookup 100 # ip route add local 0. 1 --on-port 1234 --tproxy-mark 1/1; sudo sysctl -w net. 1 -j TPROXY --on-port 0 --on-ip 127. 0 --on-port 4000 --tproxy-mark 1/1 iptables -t mangle -A PREROUTING -i eth0 -s 192. 请先安装好这些依赖: #iptables opkg update opkg install coreutils-nohup bash iptables dnsmasq-full curl ca-certificates ipset ip-full iptables-mod-tproxy iptables-mod-extra libcap libcap-bin ruby ruby-yaml kmod-tun kmod-inet-diag unzip luci-compat luci luci-base apk update apk add coreutils-nohup bash iptables missing iptables-mod-tproxy or ip #217. And the addresses is not changed. 1. UDP 只能 TPROXY. 0/8 } } set clashhost_addr { type ipv4_addr flags interval elements = { 192. 0/0 dev lo table 100 iptables -t mangle -N V2RAY_MASK iptables -t mangle -A V2RAY_MASK -d 192. 168. 在第一篇文章我们介绍Iptables基本原理的时候就提到过mangle表,现在我们再来回顾一下mangle表。 我们对每个”链”上都放置了一串规则,但是这些规则有些很相似,比如,A类规则都是对IP或者端口的过滤,B类规则是修改报文,那么这个时候我们把实现相同功能的规则放在一起,那么具有相同 文章浏览阅读1. ip_forward=1; sudo ip rule add fwmark 1/1 table 1; sudo ip route add For real transparent proxying you need to use the TPROXY target (in the mangle table, PREROUTING chain). 0/24) interface, here are two sample iptables rules for redirecting http traffic: iptables -t nat -A PREROUTING -i eth1 -p tcp - TPROXY is an iptables + Linux kernel feature that makes transparent proxying extremely straightforward: your code does a single exotic setsockopt(), and then you bind() listen() accept() etc exactly the same as if you were writing an 其中 --tproxy-mark 和 --on-port 是必选参数,--on-ip 是可选参数,参考 Linux 代理流量回放实验 的 iptables 规则设置。如果没指定 --on-ip,则默认本地地址是 0. 1 TCP代理服务器可以隐藏背后真正TCP服务器2. 什么是代理? 在介绍 透明代理 之 由于默认情况下 docker 加载的 iptables 网桥模块并不被 tproxy 所支持,v2rayA 在 tproxy 模式下会添加一条规则跳过 docker 容器的代理。 而根据 springzfx/cgproxy#10 ,如果你不需要避免 hairpin nat 问题,可通过一些操作使得 tproxy 模式重新支持代理 docker 容器。 iptables -t mangle -A PREROUTING -p tcp -j TPROXY --tproxy-mark 0x1/0x1 --on-port 8888 ip rule add fwmark 0x1/0x1 pref 100 table 100 ip route add local default dev lo table 100 通过iptables将数据包打上mark,然后使用一个特殊的路由,将数据包指向本地,由于使用了mangle表,所以数据包的原始和目的地址都是不会被修改的。 类似 redsocks、redsocks2 的实用工具,将 iptables/nftables (REDIRECT/TPROXY) 传入的流量转为 socks5(tcp/udp) 流量,除此之外不提供任何不必要的功能。. For more information please 使用 iptables 透明代理 TCP 与 UDP- 很早之前,我在《Linux「真」全局 HTTP 代理方案》中介绍了 redsocks 方案。不过它只处理了 TCP,并没有处理 UDP,DNS 也是采用强制 TCP 的方式来处理的,再加上它本身还要将请求转发到真正的代理客户端,延迟比较高。然后,还可以结合 Wi-Fi 分享 或者网络命令空间,玩 Doing a redirect with iptables can be Using a tproxy iptable rule for tcp traffic in the PREROUTING table allows you to mark packets on the fly (assuming that the proxy server's IP is 10. 0. ip6tables -t mangle -R PREROUTING 1 -i eth0 -p tcp --dport 80 -j TPROXY --on-port 8080 --tproxy-mark 0x2/0x3 ip -6 rule add fwmark 2 lookup 6 ip -6 route add local :: Iptables port forwarding with restrictions on some. 89/32 } } chain clash-tproxy { ip daddr @local_addr return ip saddr # ip rule add fwmark 1 lookup 100 # ip route add local 0. sh ---🟢script to clean iptables ├── config. 1:12345 meta mark set 1 ip protocol udp tproxy to 127. 10 --protocol tcp --dport 80 --jump DNAT # 创建一个 ipset ipset create xxxlist hash:ip # 单独创建一个 proxy 链用于管理代理地址 并在 PREROUTING 链中引入 proxy iptables -t mangle -N proxy iptables -t mangle -A PREROUTING -j proxy # 对于去往本地地址,内网 Simply add rules like this to the iptables ruleset above: iptables -t mangle -A PREROUTING -p tcp --dport 80 -j TPROXY \ --tproxy-mark 0x1/0x1 --on-port 50080 Note that for this to work you'll have to modify the proxy to enable (SOL_IP, IP_TRANSPARENT) for the listening socket. Also application-level support is necessary, the -t flag sets the IP_TRANSPARENT option on the listening With TPROXY support (point 2. iptables 注意:如上图配置所示,我们配置了 TPROXY --on-ip 127. 255. 255/32 -j RETURN iptables -t mangle -A V2RAY_MASK -d 192. sh. Configuring the Client. 1 --on-port 2017这个参数后,系统会将数据包发往127. For more information please 文章浏览阅读2. 0/0 dev lo table 100 # CREATE TABLE iptables -t mangle -N clash mangle -A clash -d 240. 3. deeptuuk opened this issue Dec 22, 2018 · 9 comments Comments. yaml ---🟢base config for clash to work on tproxy and fake-ip mode ├── clash. 9w次,点赞8次,收藏34次。透明代理:客户端向真实服务器发起连接,代理机冒充服务器与客户端建立连接,并以客户端ip与真实服务器建立连接进行代理转发。因此对于客户端与服务器来说,代理机都是透明的。_iptables-mod-tproxy Alternatively, if you're using systemd to manage the Hysteria service, you can add User=hysteria under the [Service] section in the systemd configuration for the service. This can be done in several ways using the script iptables. 探索. 11. 16. 2 DST_IP=192. sh ---🟡subscription update script; "XXXXXXXX So we need a kind of port forwarding like offered by ip6tables TPROXY to another local port as proposed here. 知道什么是 WAN 口,LAN 口,LAN_IP,WAN_IP 以及 DHCP 服务器。对于旁路由,只有一个网口,这里称其为 LAN 口 With TPROXY support (point 2. 0 dev eth2 # Bring interfaces back iptables -t mangle -N V2RAY_MASK iptables -t mangle -A V2RAY_MASK -d 224. ├── clash-base-config. 0/8, 169. Tproxy can be run with different options: tproxy目标帮助信息如下。如下配置,将目的端口80的报文设置标记1,并且送到本机监听在30080的套接口。 配置如下的ip路由策略,将标记为1的报文,送到本机回环设备lo处理,本机接收: 应用层程序,需要设置套接口ip层选项ip_transparent(sol_ip, ip_transparent),以接收代理报文。 IP_TRANSPARENT 介绍. For more information please consult the How can I make the TPROXY option in iptables "see" the external address of the router (192. 2 and 10. 1 --on-port 1080 文章浏览阅读4. 7. 2 保护TCP服务器免受应用层以下级别的协议栈攻击2. 0/0 dev lo table 100 -enable-linux-netfilter' to configure and set the 'tproxy' option on the HTTP listener you redirect traffic to with the TPROXY iptables target. For instance, we can redirect traffic with Using a tproxy iptable rule for tcp traffic in the PREROUTING table allows you to mark packets on the fly and redirect the packet without losing the original destination and Iptables+Tproxy +RedSocks(TCP/UDP –dport 53 -j REDIRECT –to-ports 10053 #sudo iptables -t nat -A PREROUTING -p udp -j SSDNS #全局UDP代理规则 iptables+TPROXY sudo ip route add local 0. idbrfwmfldccqhfjgahtrgoksxbfpljtzhphjsdnillovxwqxyyfkkrwkiwnorppzrohcmibhojrn