> For the complete documentation index, see [llms.txt](https://docs.1stream.icu/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.1stream.icu/new/smartdns-fen-liu-jiao-cheng.md).

# SmartDNS 分流教程

### 1. 安装SmartDNS

由于SmartDNS未进入软件源 需要使用软件包手动安装

{% embed url="<https://pymumu.github.io/smartdns/install/linux/>" %}
安装教程
{% endembed %}

### 2. 配置SmartDNS

请编辑 `/etc/smartdns/smartdns.conf` 以下仅为示例 请替换其中相关配置

> 对于使用 Docker/Podman 容器的用户：请使用以下配置&#x20;
>
> `bind 0.0.0.0 -no-dualstack-selection -no-speed-check`&#x20;
>
> 在启动容器时，请**务必**使用 `-p 127.0.0.1:53:53` 进行端口映射**而不是** `-p 53:53`，防止成为能够公开访问的dns。

{% code title="/etc/smartdns/smartdns.conf" lineNumbers="true" %}

```editorconfig
bind :53@lo -no-dualstack-selection -no-speed-check
#bind 0.0.0.0 -no-dualstack-selection -no-speed-check #For Docker/Podman
dualstack-ip-selection no
speed-check-mode none
#force-AAAA-SOA yes
server 1.1.1.1
server 8.8.8.8
server-https https://xxx.core.acess.xxx.fun/dns-query -group 1stream -exclude-default-group
#                 ↑此处请更换为面板中返回的实际内容
# > Netflix
nameserver /netflix.com/1stream 
nameserver /netflix.net/1stream 
nameserver /nflximg.com/1stream 
nameserver /nflximg.net/1stream 
nameserver /nflxvideo.net/1stream 
nameserver /nflxext.com/1stream 
nameserver /nflxso.net/1stream 
#如需添加域名 请以此类推。

#若要使用Else DNS 可以按照以下方法使用
server-https https://xxx.core.acess.xxx.fun/dns-query -group 1stream-else -exclude-default-group
nameserver /youtube.com/1stream-else
```

{% endcode %}

### 3. 设置系统DNS

对于任何代理程序 将dns指定为`127.0.0.1`或`[::1]`即可

```bash
chattr -i /etc/resolv.conf
echo -e "nameserver 127.0.0.1" > /etc/resolv.conf
chattr +i /etc/resolv.conf
#如需还原
chattr -i /etc/resol.conf
echo -e "nameserver 8.8.8.8" > /etc/resolv.conf
```
