大家都清楚,windows下,可以在百度里面直接查到外网的IP地址信息,但是Linux命令行下如何操作了。

在命令行下做了下测试,结果如下:

root@DY1100S01:[/home/zhang3]curl ifconfig.sh
183.129.141.155
root@DY1100S01:[/home/zhang3]curl http://iframe.ip138.com/ic.asp
<head><title>Object moved</title></head>
<body><h1>Object Moved</h1>This object may be found <a HREF="http://www.skyname.cn/">here</a>.</body>
root@DY1100S01:[/home/zhang3]curl ifconfig.me
^C
root@DY1100S01:[/home/zhang3]curl icanhazip.com
183.129.141.155

测试发现:使用curl ifconfig.sh或者curl icanhazip.com可以很快的查到外网IP地址信息。