Find IP address without ifconfig

On occasion you may need to find the IP address of a host without the ifconfig command. This often happens when you are using someone else’s system and don’t have administrative access with root, and don’t know the hostname.

Since the ifconfig is not available to you as a non root user, you will need to use another means to obtain the IP address.

[example@computer ~]$ ifconfig -a
-bash: ifconfig: command not found

Luckily the /etc directory contains all the network and IP information. Specifically

[example@computer ~]$ ls /etc/sysconfig/network-scripts/ifcfg-eth*
/etc/sysconfig/network-scripts/ifcfg-eth0

These files will contain all of the interface configurations for a system. Simply view them to get the IP address.

[example@computer ~]$ cat /etc/sysconfig/network-scripts/ifcfg-eth0 | grep IP
IPADDR=192.168.1.10

If you want to find the hostname from this IP address you can do a host lookup.

host <ip_address_goes_here>

Be the first to comment

Leave a Reply