Find the IP of a Linux Server in Command Line

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.

Pre-flight Check:

  • 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

  1. Begin the process by logging into your server via SSH:
    ssh liquidweb.example
  2. Now logged in via SSH, run the following command to check the servers IP:
    ip route

    This 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.

default via 203.0.113.1 dev eth0
203.0.113.0/24 dev eth0 proto kernel scope link src 203.0.113.86
198.51.0.0/16 dev eth0 scope link metric 1002
Any device using IP addresses will have a routing table used to determine the devices networking behavior.

In the example results, shown above, you see a 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 online here.

Adding IP Addresses to Your Server

Liquid Web allows additional IP addresses to be added to your server for a minimal fee. Having multiple IP addresses on your server can be useful when needing to differentiate domains hosted on your server. With multiple IPs you can setup advanced firewall configurations, use different hostnames with reverse DNS and more.

In any case, if you need to add more IPs to your server LiquidWeb provides a simple process through our Manage interface.

Add a New IP to Your Server

To add a new IP to your server you will first need to login to your Liquid Web account. Once logged in to the Manage interface you will see your servers and services listed on the page.

  1. To being, open the server you wish to add IP addresses to using the [+] next to the server name. Once the server is open, click on the Network button at the top of the server section.
    manage-addip-pt1
  2. This will take you to the Network tab of the Server Details page. From here, you can control your firewall, public and private network.
    manage-addip-pt2
  3. Select the Public Network tab to add IP addresses. Enter the number of new IPs you’d like to add in the box labeled “New IPs to Add”. Once filled out you can click the Add New IP(s) button to begin the process.
    manage-addip-pt3

    When adding an IP address, it will require that your server restart. A warning box will appear to confirm that you are aware. Click Add IP(s) in this pop-up to confirm and begin the process.

    manage-addip-pt3-2

  4. After clicking the Add IP(s) button, you can track the progress in the Notifications section in your Liquid Web account. After the process completes, the new IP addresses will show on the page. You can make note of them if you want and assign them to your domains.
    manage-addip-pt4

While you have the ability to add some IPs on your own, there is a limit to IPs that can be automatically assigned through Manage. If you find that you need more, please create a Support Ticket and we will be more than happy to assist you.

How To Use the IP Blocker in cPanel

  1. This tutorial assumes you’ve already logged in to cPanel, and are starting on the home screen.

    cpanel-paperlantern-19-ipblocker--01

  2. Now let’s learn how to use the IP Blocker.

    cpanel-paperlantern-19-ipblocker--02

  3. Click the "IP Blocker" icon.

    cpanel-paperlantern-19-ipblocker--03

  4. Enter an IP address or range you would like to block, then click "Add".

    cpanel-paperlantern-19-ipblocker--04

  5. That’s it! We’ve now blocked anyone using the IP address 123.45.67.89 from accessing our website.

    cpanel-paperlantern-19-ipblocker--05

  6. You can see which IP addresses are currently being blocked.

    cpanel-paperlantern-19-ipblocker--06

  7. … and you can remove IP blocks by clicking here.

    cpanel-paperlantern-19-ipblocker--07

 

How To Unblock Your IP Address in Manage

Liquid Web has introduced a new feature designed to simplify the removal of errant IP address blocks in the firewall, and allow customers to quickly remove their own address from within their Manage dashboard. In this manner, customers can remove blocks on their IP addresses even when they are unable to access WebHost Manager itself due to the block.

Pre-Flight Check

  • The cPanel Quick IP Address Unblock feature is designed for servers using the ConfigServer Firewall (CSF).
  • The feature does not apply to any server utilizing a different firewall.
  • You must have access to your Manage dashboard to use the IP delist feature.
    Note: Customers with Dedicated, Storm, or VPS servers which are not currently using the CSF firewall can request an upgrade from support to take advantage of this Manage feature. There is no charge, it typically takes only a few minutes and the only service that needs to be restarted as a result is the firewall itself. Our support technicians also can port your existing APF rules to CSF. If requesting an upgrade, please be sure to indicate whether your server uses the Guardian backup service so that its rules also can be configured.

Step #1: Log into Your Manage Interface

  1. In Manage, click on the [+] next to your server’s hostname to expand its details.
  2. Now click on the Dashboard button to open the Server Dashboard.

    Dashboard

Step #2: Unblock the IP Address

  1. Click on the Network tab to bring up the Networking pane.
  2. You will see your current IP address, as reported by your web browser, pre-populated in the cPanel Quick IP Address Unblock field. If you wish to unblock a different IP address, simply replace the address shown in the field with the IP address you wish to unblock.
    If you’re attempting to unblock the IP address of a client, developer, or other party who does not know their public IPV4 address, you can direct them to http://ip.liquidweb.com to obtain their address for you.
  3. Click the Unblock IP button to attempt to automatically remove the IP address in the CSF firewall.

    Unblock

  4. The Unblock IP button will change to Working… while it attempts to delist the IP address. Once the process completes, you should see a banner indicating whether the delisting was successful.

    Success

Step #3: I Got Blocked Again. Why?

There are many reasons why an IP address can be blocked in the firewall, but the two most common are:

  • The use of an incorrect username or password combination when connecting to the server or a service such as email, ftp, ssh, or cPanel/WHM
  • A mod_security rule violation

If you are unable to determine the cause for the block, feel free to contact Heroic Support®. You also may wish to consult the following Knowledge Base articles: Unblocking an IP Address or Opening a Port in the Firewall and How to Manage the CSF Firewall in WHM/cPanel.
 
 

Error: /usr/sbin/ifconfig: No such file or directory [SOLVED]

Pre-Flight Check
  • These instructions are intended specifically for solving the error: /usr/sbin/ifconfig: No such file or directory
  • I’ll be working from a Liquid Web Self Managed CentOS 7 server, and I’ll be logged in as root.

Continue reading “Error: /usr/sbin/ifconfig: No such file or directory [SOLVED]”