Various ways to determine public IP on CentOS/RHEL

Share It!

There are many techniques with which you can detect the public IP address of your machine. This mini-article will be helpful to you to know the public IP address using Terminal.

ip-address-lookup-logo

Install below packages If you don’t have installed, just enter following command:

# yum install curl wget lynx

Using curl

cURL is the most well known ways to determine public IP address. You simply need to know the URL or host that will response with the right public IP according as below:

# curl ifconfig.me
29.119.105.3
 
# curl ipecho.net/plain
29.119.105.3
 
# curl ident.me
29.119.105.3
 
# curl icanhazip.com
29.119.105.3
 
# curl bot.whatismyipaddress.com
29.119.105.3

Using wget

Basically, command executed on curl can be replace with wget -qO- option, as per below:

 
# wget -qO- http://ipecho.net/plain
29.119.105.3

# wget -qO-  ident.me
29.119.105.3
 
# wget -qO-  icanhazip.com
29.119.105.3
 
# wget -qO-  bot.whatismyipaddress.com
29.119.105.3

Using Lynx

Lynx is a text-based browser which runs like a browser for your CLI

# lynx checkip.dyndns.org

Leave a Reply

Your email address will not be published.