linux無法解析域名

環境:kali linux

我在用

apt autoremove git

卸載git的時候,想在安裝,結果顯示無法解析域名,害我搞了半天

ping www.baidu.com

域名不解析成ip,則是dns配置問題。

然後修改resolv.conf配置

vim  /etc/resolv.conf



nameserver 202.96.134.133

nameserver 114.114.114.114
nameserver 8.8.8.8

然後把原來的替換掉,然後記得重啓啊,應該就可以了。

 

有一次我用apt-get update更新的時候,域名又不解析了

環境:小米6的nethunter,任何手機都可刷kali.

Err:1 http://http.kali.org/kali kali-rolling InRelease        Temporary failure resolving 'http.kali.org'
Err:2 https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch InRelease
  Temporary failure resolving 'packages.microsoft.com'
Err:3 http://mirrors.ustc.edu.cn/kali kali-rolling InRelease  Temporary failure resolving 'mirrors.ustc.edu.cn'Err:4 http://mirrors.aliyun.com/kali kali-rolling InRelease
  Temporary failure resolving 'mirrors.aliyun.com'
Err:5 http://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling InRelease
  Temporary failure resolving 'mirrors.tuna.tsinghua.edu.cn'Reading package lists... Done
W: Failed to fetch http://mirrors.ustc.edu.cn/kali/dists/kali-rolling/InRelease  Temporary failure resolving 'mirrors.ustc.edu.cn'
W: Failed to fetch http://mirrors.aliyun.com/kali/dists/kali-rolling/InRelease  Temporary failure resolving 'mirrors.aliyun.com'
W: Failed to fetch http://mirrors.tuna.tsinghua.edu.cn/kali/dists/kali-rolling/InRelease  Temporary failu

 

ping www.baidu.com

域名解析

那應該不是dns配置問題

更換更新源,但還是沒解決

,找了半天,終於找到了答案,在github找到了答案。

修改/etc/passwd

vim /etc/passwd

修改

_apt: x: 104: 3004 :: / nonexistent: / bin / false

_apt: x: 0: 65534 :: / nonexistent: / bin / false

就是把“104"改成"0"

這樣改成功域名解析。

 

 

 

 

 

 

 

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章