1. 程式人生 > >Linux CentOS ping域名和curl查詢本機外網地址

Linux CentOS ping域名和curl查詢本機外網地址

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 
版權宣告:本文為博主原創文章,轉載請附上博文連結!