概述

最近在公司访问github的时候,图片无法预览。究其原因发现是github的图片资源域名被DNS污染了。只能通过修改DNS解决了,由于公司环境不允许修改路由DNS,所以只能修改本机的了。

操作流程

  1. 修改dns
vi /etc/systemd/resolved.conf 
[Resolve]
DNS=114.114.114.114
DNS=8.8.8.8
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#Cache=yes
#DNSStubListener=yes
  1. 删除旧的dns配置
rm /etc/resolv.conf
  1. 启用systemd-resolve
systemctl enable --now systemd-resolved
ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
systemctl restart NetworkManager
ls -l /etc/resolv.conf
lrwxrwxrwx 1 root root 32 Jan 12 14:09 /etc/resolv.conf -> /run/systemd/resolve/resolv.conf

其他操作

重启服务

systemctl restart systemd-resolved.service

查看dns

systemd-resolve --status

相关链接

gentoo文档