How to Find Out IP Address on CentOS 7

New to Linux CentOS 7? We are as well. We’ve been running FreeBSD 10 and CentOS 6 all this while. Just recently, we are trying to catch up with the latest CentOS and we have decided to install new VM with CentOS 7. There are a lot of changes in CentOS 7, we are yet to explore what is inside CentOS 7.

The very first thing we trying to do was lookup the IP Address for the CentOS 7 machine, before we launch our terminal and ssh into the minimal installed CentOS 7.

It came to our surprise that doing “ifconfig” and it given us the error message “ifconfig: command not found”. Initially we thought it’s super minimal installation and it doesn’t came with ifconfig. After reading through the docs, we found out the minimal installation of CentOS 7 came with really minimal stuff.

In order to find out IP Address on CentOS with minimal installation. Here is the command

# ip addr
1: lo:  mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0:  mtu 1460 qdisc pfifo_fast state UP qlen 1000
    link/ether 42:01:0a:f0:7e:a4 brd ff:ff:ff:ff:ff:ff
    inet 10.240.126.164/32 brd 10.240.126.164 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::4001:aff:fef0:7ea4/64 scope link
       valid_lft forever preferred_lft forever

centos7-find-out-ip-address-02

To find out what is the Gateway IP Address

# ip route
default via 10.240.0.1 dev eth0  proto static  metric 1024
10.240.0.1 dev eth0  proto static  scope link  metric 1

centos7-find-out-ip-address-01

Does it looks like a router command to you? It does for us 😉 Still wanted the ifconfig command? Next we will guide you through how to bring back ifconfig command in CentOS 7.

Video: How to Find Out IP Address on CentOS 7