Prevent DNS leak #2441
Replies: 1 comment
-
Assuming that you are experiencing DNS leakage from the use of your ISP's DNS server, the solution would require adjustments to both your OS and browser's DNS settings, for which you can find tutorials on the web with ease. Note that some browsers may use DoH by default, which could override the OS settings and should be aligned accordingly. A more robust resolution is to simply hijack all DNS traffic originated from your OS.
FakeDNS is commonly used, but not mandatory.
Blindly utilizing reserved IP addresses without caution may lead to errors. Opt for the default
In the eventuality that you encounter non-English documentation that is incomprehensible, resorting to translation software is a viable option given the significant improvements in NLP, resulting in mostly accurate translations. My observation indicates that Here be solutions: Chage OS DNS serverIncorporate the following configuration into your own: // vi: ft=jsonc
{
"inbounds": [
{
"tag": "dns_in",
// This should be your OS DNS address
"listen": "127.0.0.53",
"port": 53,
"protocol": "dokodemo-door",
"settings": {
"address": "1.1.1.1",
"port": 53,
"network": "tcp,udp"
}
}
],
"outbounds": [
{
"tag": "dns",
"protocol": "dns",
"proxySettings": {
// You should tag the proxy outbound before applying this configuration
// to prevent non proxied DNS traffic
"tag": "tag of your proxy outbound"
}
}
],
"dns": {
"servers": [
// DNS specified here will be used for internal name resolution and non A, AAAA queries
"1.1.1.1"
]
},
"routing": {
"rules": [
{
"outboundTag": "dns",
"inboundTag": [
"dns_in"
],
"type": "field"
}
]
}
} Subsequently, change your default DNS server to Hijack all DNS trafficTransparent proxy can facilitate this task. However, I am not sure whether Windows natively supports transparent proxy, due to the lack of documentation from Microsoft. Alternatively, you can use a Linux device as a gateway for Windows to accomplish this. v2ray configuration: // vi: ft=jsonc
{
"inbounds": [
{
"tag": "tproxy_in",
"port": 12345,
"listen": "127.0.0.1",
"protocol": "dokodemo-door",
"settings": {
"network": "tcp,udp",
"followRedirect": true
},
"sniffing": {
"enabled": true,
"metadataOnly": true,
"destOverride": [
"fakedns"
]
},
"streamSettings": {
"sockopt": {
"tproxy": "tproxy",
"mark": 255
}
}
},
{
"tag": "tproxy6_in",
"port": 12345,
"listen": "::1",
"protocol": "dokodemo-door",
"settings": {
"network": "tcp,udp",
"followRedirect": true
},
"sniffing": {
"enabled": true,
"metadataOnly": true,
"destOverride": [
"fakedns"
]
},
"streamSettings": {
"sockopt": {
"tproxy": "tproxy",
"mark": 255
}
}
}
],
"outbounds": [
{
// Here be dragons
"tag": "proxy"
},
{
"tag": "dns",
"protocol": "dns",
"proxySettings": {
"tag": "proxy"
},
"settings": {
"address": "1.1.1.1",
"port": 53
},
"streamSettings": {
"sockopt": {
"mark": 255
}
}
},
{
"tag": "direct",
"protocol": "freedom",
"settings": {
"domainStrategy": "UseIPv4"
},
"streamSettings": {
"sockopt": {
"mark": 255
}
}
},
{
"tag": "block",
"protocol": "blackhole",
"settings": {
"response": {
"type": "http"
}
}
}
],
"routing": {
"domainStrategy": "AsIs",
"domainMatcher": "mph",
"rules": [
{
"outboundTag": "proxy",
"domains": [
"domain:msftncsi.com",
"domain:msftconnecttest.com",
"domain:opendns.com"
],
"type": "field"
},
// DNS
{
"outboundTag": "dns",
"inboundTag": [
"tproxy_in",
"tproxy6_in"
],
"port": 53,
"network": "tcp,udp",
"type": "field"
},
{
"outboundTag": "direct",
"domains": [
"geosite:private"
],
"type": "field"
},
{
"outboundTag": "direct",
"ip": [
"geoip:private"
],
"type": "field"
},
// NTP
{
"outboundTag": "direct",
"inboundTag": [
"tproxy_in",
"tproxy6_in"
],
"port": 123,
"network": "udp",
"type": "field"
},
{
"outboundTag": "proxy",
"inboundTag": [
"socks_in",
"dns_in",
"tproxy_in",
"tproxy6_in"
],
"type": "field"
}
]
},
"dns": {
"tag": "dns_in",
"domainMatcher": "mph",
"hosts": {
// Here be dragons
},
"servers": [
"fakedns",
{
"address": "1.1.1.1",
"domains": [
"domain:msftncsi.com",
"domain:msftconnecttest.com",
"domain:pool.ntp.org"
]
}
],
"fakedns": [
"198.18.0.0/15",
"2001:db8::/32"
]
}
} iptables:
The ip6tables follows the same principal. The routing table needs to be modified accordingly ip rule add fwmark 1 lookup 100
ip route add local default dev lo table 100
ip -6 rule add fwmark 1 lookup 100
ip -6 route add local default dev lo table 100 I hereby disclaim any liability for any harm caused to your electronic or digital system, and shall not be held responsible for any such damages. |
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.
-
I've setup a v2ray-core server that's serves as local Proxy. I connect to it from Windows using socks5 and it then basically connects to the actual socks5 server with credentials.
Unfortunately, DNS leaks occur.
This is the configuration:
https://pastebin.com/59Y2hPE9
I understand that I need a fakedns. I don't understand Chinese and the English version features way less documentations
https://www.v2fly.org/config/fakedns.html#fakednsobject
https://www.v2fly.org/en_US/config/fakedns.html
What ip do I have to set here? What else do I need to configure that doesn't get mentioned in the English documentation?
I'd be really glad if anybody knows what to do. Thx!
Beta Was this translation helpful? Give feedback.
All reactions