Recently configured the server locally, using home bandwidth without a fixed IP address. Therefore, you need to obtain your own public IP address.
Since the machine is the server version of CentOS 6.5, there is naturally no way to obtain the public IP address through browser access.
So record some methods of obtaining public IP from the command line.
First, you need to follow curl on the machine:
[plain] view plaincopy
sudo yum install curl Secondly, use one of the following commands to get the local address:
[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
#For more usage, visit ifconfig.co
wget -qO - ifconfig.co
#Return IP and region
curl ip.6655.com/ip.aspx?area=1
curl cip.cc
The above is the detailed content of How to obtain the public IP address in the CentOS command line. For more information, please follow other related articles on the PHP Chinese website!