凡尘狂少 發表於 2017-1-22 16:08:35

CentOS如何从命令行获取公网IP

<p>最近本地配置了服务器,使用了家用的带宽没有固定的IP地址。因此,需要获取到自己的公网IP地址。</p>
<p>机器是CentOS 6.5的服务器版本自然就没有办法通过浏览器访问的方式获取到公网IP地址。</p>
<p>因此记录一些从命令行获取公网IP的方法。</p>
<p><strong>首先,需要在机器上按照curl:</strong></p>
<p><strong></strong>&nbsp;view plaincopy </p>
<p>sudo&nbsp;yum&nbsp;install&nbsp;curl&nbsp;&nbsp; 其次,使用下列命令中得一个来获取本地地址: </p>
<p><strong></strong>&nbsp;view plaincopy </p>
<p>curl&nbsp;http://members.3322.org/dyndns/getip&nbsp;&nbsp; </p>
<p>curl&nbsp;ip.6655.com/ip.aspx&nbsp;&nbsp; </p>
<p>curl&nbsp;ifconfig.me&nbsp;&nbsp; </p>
<p>curl&nbsp;icanhazip.com&nbsp;&nbsp; </p>
<p>curl&nbsp;ident.me&nbsp;&nbsp; </p>
<p>curl&nbsp;ipecho.net/plain&nbsp;&nbsp; </p>
<p>curl&nbsp;whatismyip.akamai.com&nbsp;&nbsp; </p>
<p>curl&nbsp;myip.dnsomatic.com&nbsp;&nbsp; &nbsp;&nbsp; </p>
<p>#更多用法访问ifconfig.co&nbsp;&nbsp; </p>
<p>wget&nbsp;-qO&nbsp;-&nbsp;ifconfig.co&nbsp;&nbsp; &nbsp;&nbsp; </p>
<p>#返回IP和地区&nbsp;&nbsp; </p>
<p>curl&nbsp;ip.6655.com/ip.aspx?area=1&nbsp;&nbsp; </p>
<p>curl&nbsp;cip.cc &nbsp; </p>
頁: [1]
查看完整版本: CentOS如何从命令行获取公网IP