/在 Linux 上手动设置 DNS

Created Tue, 26 Jan 2021 21:43:35 +0800 Modified Fri, 09 Aug 2024 13:25:47 +0000
156 Words 1 min

Arch Linux DNS 设置

  1. 安装dnsmasq
sudo pacman -S dnsmasq
  1. 配置/etc/resolv.conf中的域名代理服务器
# Tencent
nameserver 119.29.29.29
nameserver 182.254.118.118

# Ali
nameserver 223.5.5.5
nameserver 223.6.6.6

# OpenDNS IPv4 nameservers
nameserver 208.67.222.222
nameserver 208.67.220.220

# OpenDNS IPv6 nameservers
nameserver 2620:0:ccc::2
nameserver 2620:0:ccd::2

# Google IPv4 nameservers
nameserver 8.8.8.8
nameserver 8.8.4.4

# Google IPv6 nameservers
nameserver 2001:4860:4860::8888
nameserver 2001:4860:4860::8844

# Comodo nameservers
nameserver 8.26.56.26
nameserver 8.20.247.20

# Generated by NetworkManager
nameserver 192.168.1.1
  1. 防止/etc/resolv.conf被修改
sudo chattr +i /etc/resolv.conf
  1. 减少主机名查找时间
sudo echo "options timeout:1" > /etc/resolv.conf.tail
  1. 启动dnsmasq
sudo systemctl enable dnsmasq.service --now