Files
smartdns/docs/config/dualstack.md
2023-03-11 17:52:57 +08:00

53 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
hide:
- toc
---
# 双栈优选
目前大部分家庭用户已经有IPV6IPV4双栈网络目前大部分操作系统都会优先使用IPV6网络但某些域名会出现IPV4网络好于IPV6的情况另外一些域名会出现IPV6网络好于IPV4的情况。
SmartDNS提供了双栈优选的功能会自动进行测速优先让客户端操作系统使用速度快的IP地址。
## 配置步骤
1. 使用`dualstack-ip-selection`配置启用双栈优选
```shell
dualstack-ip-selection yes
```
1. 如需要倾向使用IPV6则可以使用`dualstack-ip-selection-threshold`进行阈值调整
```shell
dualstack-ip-selection-threshold 10
```
注意:
1. 单位为ms两个IP地址的速度阈值大于配置值时才会进行优选。
1. 允许纯IPV6地址。
smartdns默认情况下总是会返回IPV4地址原因时某些软件不具备IPV6的访问能力但如果确实需要使用纯IPV6地址可以设置允许smartdns仅优选IPV6。
```shell
dualstack-ip-allow-force-AAAA yes
```
## 特殊应用
某些情况下,可能要临时关闭某些域名的双栈优选,可以通过如下两种方式:
1. 对指定端口查询的域名关闭优选
```shell
bind [::]:53 -no-dualstack-selection
```
1. 对特定域名关闭优选
```shell
domain-rules /example.com/ -dualstack-ip-selection no
```