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:

or

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.

<img data-lazy-src="https://kirelos.com/wp-content/uploads/2021/03/echo/word-image-277.png604bd46c36663.jpg" src="data:image/svg xml,”>

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:

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.

<img data-lazy-src="https://kirelos.com/wp-content/uploads/2021/03/echo/word-image-278.png604bd46d232fb.jpg" src="data:image/svg xml,”>

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.

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

<img data-lazy-src="https://kirelos.com/wp-content/uploads/2021/03/echo/word-image-279.png604bd46db22a1.jpg" src="data:image/svg xml,”>

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.

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

<img data-lazy-src="https://kirelos.com/wp-content/uploads/2021/03/echo/word-image-280.png604bd46e78646.jpg" src="data:image/svg xml,”>

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:

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

<img data-lazy-src="https://kirelos.com/wp-content/uploads/2021/03/echo/word-image-281.png604bd46f1f990.jpg" src="data:image/svg xml,”>

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.

<img data-lazy-src="https://kirelos.com/wp-content/uploads/2021/03/echo/word-image-282.png604bd46fbbe61.jpg" src="data:image/svg xml,”>

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

<img data-lazy-src="https://kirelos.com/wp-content/uploads/2021/03/echo/word-image-283.png604bd4705caac.jpg" src="data:image/svg xml,”>

Then select Wired Settings.

<img data-lazy-src="https://kirelos.com/wp-content/uploads/2021/03/echo/word-image-284.png604bd470efbc1.jpg" src="data:image/svg xml,”>

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.

<img data-lazy-src="https://kirelos.com/wp-content/uploads/2021/03/echo/word-image-285.png604bd471b4ca1.jpg" src="data:image/svg xml,”>

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.

<img data-lazy-src="https://kirelos.com/wp-content/uploads/2021/03/echo/word-image-286.png604bd4727e379.jpg" src="data:image/svg xml,”>

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

<img alt="LinuxWays Team" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/03/echo/Linux-Ways-Logo-Final-update-nnnnn-150×82.jpg604bd4728c615.jpg" height="61" src="data:image/svg xml,” width=”112″>

LinuxWays Team

We create HowTos and Tutorials for Sys Admins. Visit us on <a href="https://linuxways.net/"LinuxWays.net