Linux CentOS ping域名和curl查询本机外网地址

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/boonya/article/details/83022740

CentOS ping安装

yum install iputils

CentOS域名异常处理

异常一:ping异常

centos7 ping: www.baidu.com: Name or service not known

异常二:curl 域名异常

curl: (6) Could not resolve host: www.baidu.com

DNS处理方法,修改vi /etc/resolv.conf:

# Generated by NetworkManager
nameserver 114.114.114.114
nameserver 8.8.8.8
~                   

CentOs验证本地外网IP

使用curl命令访问公网域名解析地址:

$ curl ifconfig.me
$ curl icanhazip.com
$ curl ident.me
$ curl ipecho.net/plain
$ curl whatismyip.akamai.com
$ curl tnx.nl/ip
$ curl myip.dnsomatic.com
$ curl ip.appspot.com
$ curl -s checkip.dyndns.org | sed 's/.*IP Address: [0−9\.]∗

---------------------
作者:seekthere 
来源:CSDN 
原文:https://blog.csdn.net/seekkevin/article/details/50554616?utm_source=copy 
版权声明:本文为博主原创文章,转载请附上博文链接!

猜你喜欢

转载自blog.csdn.net/boonya/article/details/83022740