Knowing your server’s IP address(s) can be a useful bit of information to have for various reasons. After all, other than your domain, the server’s IP is the main address used to reach the server. Knowing a server’s IPs may be necessary when making changes to: DNS, networking, and security. A server may have a single IP, or multiple IPs, sometimes you need a quick way double check since it’s easy to forget.
This tutorial will teach you how to check the IPs of any modern Linux server. To follow along will simply need access to the server via SSH or TTY.
- This tutorial requires basic knowledge of SSH and command line.
See our KB article on command line access via SSH.
- You must have SSH access to the server.
Check IPs with Command Line
- Begin the process by logging into your server via SSH:
- Now logged in via SSH, run the following command to check the servers IP:
ip routeThis command is using the `ip` tool and is calling the `route` object, this command prints the current routing table.
Reading the Results
Once you execute that command you’ll see output similar to the following text. This is showing the servers IP routing table, essentially this is a set of rules used to determine where data will be directed.
When using this technique to find a server’s IPs you’ll keep an eye out for lines containing `src` followed by an IP. On these lines, the IP address following `src` are an IP configured on the server.
203.0.113.0/24 dev eth0 proto kernel scope link src 203.0.113.86
220.127.116.11/16 dev eth0 scope link metric 1002
In the example results, shown above, you see the severs routing table showing that the server has an IP address of: `203.0.113.86`.
While it may not look like much to new users these lines are dense with information. Each line of the routing table is there to describe a different behavior or condition. More information on these can be found in the ip commands manual pages, these can be found in the command line using `man ip route`. You can also read the man page for the IP command online.