xray 透明代理dns的问题 #2446
Replies: 8 comments 4 replies
-
单独在53端口开个dokodemo-door,然后在路由导入dns模块 {
"port": 53,
"protocol": "dokodemo-door",
"settings": {
"address": "233.233.233.233",
"port": 53,
"network": "tcp,udp"
},
"tag": "dns-in"
},
"routing": {
"domainStrategy": "IPIfNonMatch",
"rules": [
{
"type": "field",
"inboundTag": [],
"ip": ["233.233.233.233"],
"outboundTag": "dns-out"
}, 最后将dns指向这里 |
Beta Was this translation helpful? Give feedback.
-
您好,楼主: 我最近也遇到和你类似的问题,怀疑是xray 内置DNS 解析问题,不知您是否已经解决? xray:v1.8.3 1、一些网站检测 ip 地区无法通过(已经添加域名规则,且该ip在全局模式下可以通过网站地区检测)
|
Beta Was this translation helpful? Give feedback.
-
我用nftables把国内ip全部绕过了。然后,所有的非国内IP全部走xray.
InnocenseYu ***@***.***> 于2023年10月20日周五 00:46写道:
… 您好,楼主:
我最近也遇到和你类似的问题,怀疑是xray 内置DNS 解析问题,不知您是否已经解决?
xray:v1.8.3
openwrt: linux 内核版本 5.4.236
xray 配置文件相同,仿照该网址
<https://xtls.github.io/document/level-2/tproxy_ipv4_and_ipv6.html#%E5%AE%A2%E6%88%B7%E7%AB%AF%E9%85%8D%E7%BD%AE>
路由规则和防火墙见下文
1、一些网站 <https://www.histar.tv/>检测 ip 地区无法通过(已经添加域名规则,且该ip在全局模式下可以通过网站地区检测)
2、github 项目主页可以打开,但是无法展示 readme 的图文,还有无法打开网址 githubusercontent.com,比如这个项目
https://github.com/m3u8playlist/dp
3. obsidian 软件的社区插件库无法打开
路由规则:
ip route add local 0.0.0.0/0 dev lo table 100
ip rule add fwmark 1 table 100
防火墙规则:
iptables -t mangle -N XRAY
iptables -t mangle -A XRAY -d 127.0.0.1/8 -j RETURN
iptables -t mangle -A XRAY -d 224.0.0.0/4 -j RETURN
iptables -t mangle -A XRAY -d 255.255.255.255/32 -j RETURN
iptables -t mangle -A XRAY -d 192.168.0.0/16 -p tcp ! --dport 53 -j RETURN
iptables -t mangle -A XRAY -d 192.168.0.0/16 -p udp ! --dport 53 -j RETURN
iptables -t mangle -A XRAY -j RETURN -m mark --mark 0xff
iptables -t mangle -A XRAY -p udp -j TPROXY --on-ip 127.0.0.1 --on-port 12345 --tproxy-mark 1
iptables -t mangle -A XRAY -p tcp -j TPROXY --on-ip 127.0.0.1 --on-port 12345 --tproxy-mark 1
iptables -t mangle -A PREROUTING -j XRAY
iptables -t mangle -N XRAY_MASK
iptables -t mangle -A XRAY_MASK -d 224.0.0.0/4 -j RETURN
iptables -t mangle -A XRAY_MASK -d 255.255.255.255/32 -j RETURN
iptables -t mangle -A XRAY_MASK -d 192.168.0.0/16 -p tcp ! --dport 53 -j RETURN
iptables -t mangle -A XRAY_MASK -d 192.168.0.0/16 -p udp ! --dport 53 -j RETURN
iptables -t mangle -A XRAY_MASK -j RETURN -m mark --mark 0xff
iptables -t mangle -A XRAY_MASK -p udp -j MARK --set-mark 1
iptables -t mangle -A XRAY_MASK -p tcp -j MARK --set-mark 1
iptables -t mangle -A OUTPUT -j XRAY_MASK
iptables -t mangle -N DIVERT
iptables -t mangle -A DIVERT -j MARK --set-mark 1
iptables -t mangle -A DIVERT -j ACCEPT
iptables -t mangle -I PREROUTING -p tcp -m socket -j DIVERT
—
Reply to this email directly, view it on GitHub
<#2446 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AF33KENDXO7BTLEX476KXXDYAFKOBAVCNFSM6AAAAAA3R3LOXSVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TGMZQGQ4TQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
然后dns使用SmartDNS。
InnocenseYu ***@***.***> 于2023年10月20日周五 00:46写道:
… 您好,楼主:
我最近也遇到和你类似的问题,怀疑是xray 内置DNS 解析问题,不知您是否已经解决?
xray:v1.8.3
openwrt: linux 内核版本 5.4.236
xray 配置文件相同,仿照该网址
<https://xtls.github.io/document/level-2/tproxy_ipv4_and_ipv6.html#%E5%AE%A2%E6%88%B7%E7%AB%AF%E9%85%8D%E7%BD%AE>
路由规则和防火墙见下文
1、一些网站 <https://www.histar.tv/>检测 ip 地区无法通过(已经添加域名规则,且该ip在全局模式下可以通过网站地区检测)
2、github 项目主页可以打开,但是无法展示 readme 的图文,还有无法打开网址 githubusercontent.com,比如这个项目
https://github.com/m3u8playlist/dp
3. obsidian 软件的社区插件库无法打开
路由规则:
ip route add local 0.0.0.0/0 dev lo table 100
ip rule add fwmark 1 table 100
防火墙规则:
iptables -t mangle -N XRAY
iptables -t mangle -A XRAY -d 127.0.0.1/8 -j RETURN
iptables -t mangle -A XRAY -d 224.0.0.0/4 -j RETURN
iptables -t mangle -A XRAY -d 255.255.255.255/32 -j RETURN
iptables -t mangle -A XRAY -d 192.168.0.0/16 -p tcp ! --dport 53 -j RETURN
iptables -t mangle -A XRAY -d 192.168.0.0/16 -p udp ! --dport 53 -j RETURN
iptables -t mangle -A XRAY -j RETURN -m mark --mark 0xff
iptables -t mangle -A XRAY -p udp -j TPROXY --on-ip 127.0.0.1 --on-port 12345 --tproxy-mark 1
iptables -t mangle -A XRAY -p tcp -j TPROXY --on-ip 127.0.0.1 --on-port 12345 --tproxy-mark 1
iptables -t mangle -A PREROUTING -j XRAY
iptables -t mangle -N XRAY_MASK
iptables -t mangle -A XRAY_MASK -d 224.0.0.0/4 -j RETURN
iptables -t mangle -A XRAY_MASK -d 255.255.255.255/32 -j RETURN
iptables -t mangle -A XRAY_MASK -d 192.168.0.0/16 -p tcp ! --dport 53 -j RETURN
iptables -t mangle -A XRAY_MASK -d 192.168.0.0/16 -p udp ! --dport 53 -j RETURN
iptables -t mangle -A XRAY_MASK -j RETURN -m mark --mark 0xff
iptables -t mangle -A XRAY_MASK -p udp -j MARK --set-mark 1
iptables -t mangle -A XRAY_MASK -p tcp -j MARK --set-mark 1
iptables -t mangle -A OUTPUT -j XRAY_MASK
iptables -t mangle -N DIVERT
iptables -t mangle -A DIVERT -j MARK --set-mark 1
iptables -t mangle -A DIVERT -j ACCEPT
iptables -t mangle -I PREROUTING -p tcp -m socket -j DIVERT
—
Reply to this email directly, view it on GitHub
<#2446 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AF33KENDXO7BTLEX476KXXDYAFKOBAVCNFSM6AAAAAA3R3LOXSVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TGMZQGQ4TQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
使用nftables把所有国内IP都放行,再把所有的非国内IP都导入到xray中。DNS使用的事SmartDNS。现在问题已经解决。 |
Beta Was this translation helpful? Give feedback.
-
这个就不太懂了。
huyi51462 ***@***.***> 于2023年10月21日周六 09:39写道:
… 你们的问题大概率是非对称路由丢包
—
Reply to this email directly, view it on GitHub
<#2446 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AF33KEP326KR3ZV2YGOHAXDYAMRTVAVCNFSM6AAAAAA3R3LOXSVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TGNBUGI4TE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I have exactly the same issue, did you resolve it? My issue is from sticking extra stuff after xray |
Beta Was this translation helpful? Give feedback.
-
my paswall system work good
iopq ***@***.***> 于2025年4月9日周三 22:20写道:
… I have exactly the same issue, did you resolve it?
—
Reply to this email directly, view it on GitHub
<#2446 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMBRERL7CF3PNZJ3DAOFTTL2YUUDPAVCNFSM6AAAAAB2ZEHFS2VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTENZXHEZDGOA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
xray 透明代理dns的问题
首先,我并非新人和伸手党,我自己在网络上查阅了大量的资料,和经过了多次尝试,仍有问题和不解,希望大佬不吝帮忙。
情况说明:使用ubuntu+nftables+xray配置软路由
问题点:主要是dns这一块,现在的情况是,打开Twitter刷不出视频,打开github超慢。
(个人经过测试,在相同的代理节点的情况下,使用shadowrocket+移动5G,也就是不经过ubuntu的透明代理的情况下,访问完全正常,所以,我100%确认,节点没有问题,问题就出在dns的配置上)
我的xray配置:
我的nftables配置
Beta Was this translation helpful? Give feedback.
All reactions