Methods to Find Your Private IP Address in CentOS 8 ?

Are you trying to find Your Private IP Address on CentOS system ?

This guide is for you.


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, and so on. 

In our previous posts, we have shared with you some ways to find the private IP address in Ubuntu and Debian OS.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform CentOS related queries.

In this context, we shall look into how to find the private IP address in CentOS8.


How to find Private IP Address on CentOS ?

Here, you will learn different ways which can be implemented via both the command line and GUI based methods.

Now let's see the ways to find private IP address in CentOS 8.


1. Using “ip” command to find private IP address on CentOS

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. 


2. using “ifconfig” command to find private IP address on CentOS

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. 


3. Using “hostname” command to find private IP address on CentOS

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


4. Using “nmcli” command to find private IP address on CentOS

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


5. Using ip route command to find private IP address on CentOS

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. 

Run the following command in Terminal to find your private IP address:

$ ip route


6. Using GUI to find private IP address on CentOS

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. 

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.

Now you will see a window in the Details tab containing your private IP address.


[Need urgent assistance to install Missing Packages on Linux? We are available to help you. ]

This article will guide you on the different methods to find the private IP address in CentOS 8.


Different ways to display IP addresses in Centos:

1. Using ifconfig command. The ifconfig command is the most commonly used command for displaying and modifying IP addresses on the system.

2. Using ip command.

3. Using the hostname command.

4. using nmcli command.

5. Using ip route show command.


To configure a static IP address on CentOS 7 / RHEL 7:

1. Create a file named /etc/sysconfig/network-scripts/ifcfg-eth0 as follows:

2. DEVICE=eth0.

3. BOOTPROTO=none.

4. ONBOOT=yes.

5. PREFIX=24.

6. IPADDR=192.168.x.xxx.

7. Restart network service: systemctl restart network.


Commands will get you the private IP address of your interfaces:

i. ifconfig -a.

ii. ip addr (ip a)

iii. hostname -I | awk '{print $1}'

iv. (Fedora) Wifi-Settings→ click the setting icon next to the Wifi name that you are connected to → Ipv4 and Ipv6 both can be seen.

v. nmcli -p device show.

Related Posts