[参考链接] (https://www.techrepublic.com/article/how-to-set-dns-nameservers-in-ubuntu-server-18-04/)
装了ubuntu20.04,修网修改dns,百度了一下,中文网站的方法都不对,最后还是google出来的。
修改网络配置文件:
sudo vim /etc/netplan/00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
ethernets:
enp0s3:
addresses:
- 192.168.2.51/24
gateway4: 192.168.2.1
nameservers:
addresses:
- 192.168.2.1
version: 2
再执行
sudo netplan apply
设置完成