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:
Using ifconfig command. The ifconfig command is the most commonly used command for displaying and modifying IP addresses on the system.
Using ip command.
Using the hostname command.
using nmcli command.
Using ip route show command.
To configure a static IP address on CentOS 7 / RHEL 7:
Create a file named /etc/sysconfig/network-scripts/ifcfg-eth0 as follows:
DEVICE=eth0.
BOOTPROTO=none.
ONBOOT=yes.
PREFIX=24.
IPADDR=192.168.x.xxx.
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.
https://linuxapt.com/blog/100-methods-to-find-your-private-ip-address-in-centos-8