背景
有时候不小心,我们会把系统的一些网络配置修改了,或者DNS被污染,导致无法访问到各种域名,但是我们并没有图形化界面可以直接修改,因此需要通过命令修改DNS
Could not resolve host: gitee.com
操作步骤
安装工具
$ sudo apt install resolvconf
添加DNS
$ sudo vi /etc/resolvconf/resolv.conf.d/base
内容如下:
nameserver 8.8.8.8
nameserver 114.114.114.114
nameserver 192.168.2.1
- 注意:
192.168.2.1是指内网的网关,可根据需要更改
更新网络配置
$ resolvconf -u
重新测试
上面的步骤即可完成DNS的配置,可重新访问gitee.com
$ git clone -v https://gitee.com/wilson202008/dapr-installer.git
Cloning into 'dapr-installer'...
POST git-upload-pack (165 bytes)
remote: Enumerating objects: 12, done.
remote: Counting objects: 100% (12/12), done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 12 (delta 2), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (12/12), 44.75 MiB | 3.25 MiB/s, done.
|