Linux系统中/etc/resolv.conf的作用

在公司一台服务器上使用yum方式搭建zabbix-agent组件的时候,提示说无法解析域名地址

[root@jcsjoracle ~]# rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/6/x86_64/zabbix-release-4.0-1.el6.noarch.rpm
Retrieving https://repo.zabbix.com/zabbix/4.0/rhel/6/x86_64/zabbix-release-4.0-1.el6.noarch.rpm
curl: (6) Couldn't resolve host 'repo.zabbix.com'
error: skipping https://repo.zabbix.com/zabbix/4.0/rhel/6/x86_64/zabbix-release-4.0-1.el6.noarch.rpm - transfer failed
[root@jcsjoracle ~]# rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/6/x86_64/zabbix-release-4.0-1.el6.noarch.rpm
Retrieving https://repo.zabbix.com/zabbix/4.0/rhel/6/x86_64/zabbix-release-4.0-1.el6.noarch.rpm
curl: (6) Couldn't resolve host 'repo.zabbix.com'
error: skipping https://repo.zabbix.com/zabbix/4.0/rhel/6/x86_64/zabbix-release-4.0-1.el6.noarch.rpm - transfer failed

使用ping方式查看域名地址会无法解析,查看具体IP地址正常

[root@jcsjoracle ~]# ping www.baidu.com
ping: unknown host www.baidu.com
[root@jcsjoracle ~]# ping 10.40.209.59
PING 10.40.209.59 (10.40.209.59) 56(84) bytes of data.
64 bytes from 10.40.209.59: icmp_seq=1 ttl=64 time=4.49 ms
64 bytes from 10.40.209.59: icmp_seq=2 ttl=64 time=0.910 ms
^C
--- 10.40.209.59 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1926ms
rtt min/avg/max/mdev = 0.910/2.700/4.491/1.791 ms

网上搜索资料发现是因为域名没有被正常解析,需要配置DNS

[root@jcsjoracle ~]# vi /etc/resolv.conf 
nameserver 114.114.114.114

配置完成后,不需要重启服务器,再次ping域名地址,提示正常,最后通过yum方式下载zabbix-agent也正常

[root@jcsjoracle ~]# ping www.baidu.com
PING www.a.shifen.com (163.177.151.110) 56(84) bytes of data.
64 bytes from 163.177.151.110: icmp_seq=1 ttl=54 time=5.47 ms
64 bytes from 163.177.151.110: icmp_seq=2 ttl=54 time=3.91 ms
^C
--- www.a.shifen.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1403ms
rtt min/avg/max/mdev = 3.916/4.694/5.472/0.778 ms
[root@jcsjoracle ~]# rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/6/x86_64/zabbix-release-4.0-1.el6.noarch.rpm
Retrieving https://repo.zabbix.com/zabbix/4.0/rhel/6/x86_64/zabbix-release-4.0-1.el6.noarch.rpm
warning: /var/tmp/rpm-tmp.VVeU80: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Preparing...                ########################################### [100%]
   1:zabbix-release         ########################################### [100%]

猜你喜欢

转载自www.cnblogs.com/maple-study/p/10470541.html
今日推荐