CentOS

6 Ways to Find Your Private IP Address in CentOS 8

Introduction

Private IP addresses are used to communicate inside a local network. Private IP addresses cannot be routed and hence no traffic can be sent to them from the external network. There may come a time when you need to know the private IP address of your system like to setup a network-related application, to enable remote administration, or for troubleshooting, etc. In our previous posts, we have shared with you some ways to find the private IP address in Ubuntu and Debian OS.

In this post, we will describe some methods to find the private IP address in CentOS8. These methods involve both the command line and GUI based methods.

Following are the IP address ranges that are defined by IANA:

10.0.0.0/8=10.0.0.0 – 10.255.255.255
192.168.0.0/16=192.168.0.0 – 192.168.255.255
172.16.0.0/12=172.16.0.0 – 172.31.255.255

6 Ways to find private IP address in CentOS 8

Method # 1: The “ip” command

The most common way to find an IP address in CentOS is by using the “ip” command. Simply type ip followed by the addr” or “a” option:

$ ip a

or

$ ip addr

This command will display all the network interfaces along with their associated private IP addresses. The following output shows our private IP is 192.168.72.130/24.

Method # 2: The “ifconfig” command

The “ifconfig” command is also used to find the private IP address. To use this command, just type ifconfig in the terminal:

$ ifconfig

If running the above command gives you a “command not found” error, then you will have to first install the net-tools as follows:

$ sudo yum -y install net-tools

Once installed, you can then use it to find the private IP address.

This command will display all the network interfaces along with their associated private IP addresses. The following output shows our private IP is 192.168.72.130/24.

Method # 3: The “hostname” command

The “hostname” command is usually used to find the hostname of the system. However, using the hostname command with the -l option provides you with IP address information.

$ hostname -I

Following is the output of above command which shows our private IP is 192.168.72.130.

Method # 4: The “nmcli” command

The “nmcli” is a command-line utility for controlling NetworkManager. It can also be used to find the private IP address of your system.

$ nmcli

Here is the output of the nmcli command which shows the private address on our system is 192.168.72.130/24.

Method 5: Using ip route command

The “ip route” command is used to configure and display static routes in Linux OS. This command also shows the private IP address of a system. Issue the following command in Terminal to find your private IP address:

$ ip route

Here is the output of the nmcli command which shows the private address on our system is 192.168.72.130/24.

Method 6: Using GUI

This method is for all those users who prefer working on GUI instead of the command line. In order to find the private IP address via GUI, click the network icon in the top right corner of your desktop. This step is also highlighted in the following screenshot.

Then a menu will show up on your desktop. Click the Wired Connected option.

Then select Wired Settings.

The Settings window will appear in the Network view. Click the cog icon in front of the network interface also shown highlighted in the following screenshot.

Now the following window will open in the Details tab. Here you will find your private IP address in the Details tab which in our case is 192.168.72.130.

In this post, we have described several ways through which you can find the private IP address in CentOS 8. If you know of some other ways that we have missed for finding the private IP address in CentOS, please share with us in the comments!

About the author

LinuxWays Team

We create HowTos and Tutorials for Sys Admins. Visit us on LinuxWays.net