Every computer, whether server or client, connected to the Internet has an assigned IP address and communicates with other services using the TCP/IP protocol. In this tutorial, we will learn how to find out public and private IP addresses on Rocky Linux. You can find out your IP address either through the terminal or through a GUI option. So let’s get started. The same commands work on other RHEL-based Linux distributions like AlmaLinux and CentOS too.

Find the Public IP address on Rocky Linux

Here is a list of commands and services that can be used to get your external IP address. Just paste one of the on the command line to get the IP.

  • curl ifconfig.me
  • curl icanhazip.com
  • curl ipinfo.io/ip
  • curl api.ipify.org
  • curl checkip.dyndns.org
  • dig +short myip.opendns.com @resolver1.opendns.com
  • host myip.opendns.com resolver1.opendns.com
  • curl ident.me
  • curl bot.whatismyipaddress.com
  • curl ipecho.net/plain

Check Private IP Address via Terminal

To find out your system IP address through the terminal, open up the terminal and type the following command:

# ifconfig
# ip addr show
# ip a

You can use any one of the following commands to view your system IP address.

Get Internal IP address

As you can see network adapter ens33 with IP address 192.168.40.130/24 is assigned to my system.

Check Private IP Address via GUI

For this option, you must have GUI installed on your System. Now login to your system and type Settings in the search bar and click:

Open settings

The sidebar appears on your left side, navigate to the Network tab. After that click on the icon which was highlighted, to view system IP address as shown in the figure:

Network settings

Now you can see your system IP address which is 192.168.40.130.

IP address

Conclusion

In this tutorial, we learned how to find out your Public IP address using curl, host, and dig. We also saw how to find a system’s internal Private IP address using CLI and GUI in Rocky Linux 8.

How to find your IP Address (IPv4 and IPv6) on Rocky Linux