出现“Could not resolve host: www.github.com; Unknown error”错误解决

出现“Could not resolve host: www.github.com; Unknown error”错误解决

  • 一、报错提示
  • 二、测试外网百度域名访问
  • 三、查看dns配置
  • 四、配置dns
  • 五、测试外网访问下载

一、报错提示

[root@node-1 ~]# curl www.github.com
curl: (6) Could not resolve host: www.github.com; Unknown error

二、测试外网百度域名访问

[root@node-1 ~]# ping www.baidu.com
ping: unknown host www.baidu.com

三、查看dns配置

[root@node-1 network-scripts]# cat ifcfg-eth0 
TYPE="Ethernet"
BOOTPROTO=none
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
NAME="eth0"
UUID="c3b26ff5-82d4-450a-8a3b-e19a19c1bd4c"
DEVICE="eth0"
ONBOOT="yes"
IPADDR=192.168.3.11
PREFIX=24
GATEWAY=192.168.3.254
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes


四、配置dns

[root@node-1 network-scripts]# nmcli con modify eth0 ipv4.dns 192.168.3.254 ipv4.method manual
[root@node-1 network-scripts]# nmcli con reload 
[root@node-1 network-scripts]# nmcli con up eth0 
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/1)

五、测试外网访问下载

[root@node-1 network-scripts]# ping www.baidu.com -c 4
PING www.a.shifen.com (112.80.248.76) 56(84) bytes of data.
64 bytes from 112.80.248.76: icmp_seq=1 ttl=55 time=22.1 ms
64 bytes from 112.80.248.76: icmp_seq=2 ttl=55 time=22.2 ms
64 bytes from 112.80.248.76: icmp_seq=3 ttl=55 time=22.0 ms
64 bytes from 112.80.248.76: icmp_seq=4 ttl=55 time=21.7 ms

--- www.a.shifen.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3002ms
rtt min/avg/max/mdev = 21.785/22.051/22.253/0.231 ms



[root@node-1 ~]# 
[root@node-1 ~]# wget https://dl.360safe.com/360zip_setup.exe
--2021-12-31 23:38:54--  https://dl.360safe.com/360zip_setup.exe
Resolving dl.360safe.com (dl.360safe.com)... 36.32.131.66, 36.32.131.67, 118.212.132.249, ...
Connecting to dl.360safe.com (dl.360safe.com)|36.32.131.66|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14771792 (14M) [application/octet-stream]
Saving to: ‘360zip_setup.exe’

100%[=============================================================================================>] 14,771,792  15.5MB/s   in 0.9s   

2021-12-31 23:38:55 (15.5 MB/s) - ‘360zip_setup.exe’ saved [14771792/14771792]

你可能感兴趣的:(Linux,github,bash,linux)