最近本地配置了服务器,使用了家用的带宽没有固定的ip地址。因此,需要获取到自己的公网ip地址。
机器是CentOS 6.5的服务器版本自然就没有办法通过浏览器访问的方式获取到公网IP地址。
因此记录一些从命令行获取公网IP的方法。
首先,需要在机器上按照curl:
[plain] view plaincopy
sudo yum install curl 其次,使用下列命令中得一个来获取本地地址:
[html] view plaincopy
curl http://members.3322.org/dyndns/getip
curl ip.6655.com/ip.aspx
curl ifconfig.me
curl icanhazip.com
curl ident.me
curl ipecho.net/plain
curl whatismyip.akamai.com
curl myip.dnsomatic.com
#更多用法访问ifconfig.co
wget -qO - ifconfig.co
#返回IP和地区
curl ip.6655.com/ip.aspx?area=1
curl cip.cc
以上就是获取CentOS命令行中的公网IP地址的方法的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号