Signup/Sign In
PUBLISHED ON: FEBRUARY 9, 2022

How to Find/Get Your IP Address In Linux

IP address

Introduction

The IP addresses are code name that is issued to a machine on a network. It functions like the postal address which is supplying network traffic is moved to the relevant system.

Prerequisites

  • A Linux OS
  • Access to a command line/terminal window

Find our IP address using Command Line

There are numerous other commands we may use for checking our IP address. We may begin by opening a command line/terminal window to run these instructions.

1. With the hostname command

From the terminal window, we can verify our IP address with the aid of the following command:

hostname -I

Our system will reveal the internal IP address.

2. With the ip addr Command

We may check our IP address by running a command, i.e., ip addr.

ip addr

Our system will scan our hardware and provide the status of all the network adapters we have. Check for the entry that tells ether/link. We should see any one of the below:

inet 192.168.0.10/24
inet6 fe80::a00:27ff:fe76:1e71/64

These entries will have one for a wireless or WiFi adapter or wired or Ethernet adapter. Also, we may have the entry for the virtual adapter. Only one item will normally have the IP address stated which is the one we will desire.

Important: The number behind the slash /64 — and —/24 denotes the network size. Also, it assists in mapping and scanning the size of the network.

3. With the ifconfig Command

This strategy is utilized for determining our IP address associates using the ifconfig command. Type the following command in this command line:

ifconfig

The system will display every network connection like virtual, connected, and severed. Check for the one labeled MULTICAST, RUNNING, BROADCAST, UP for discovering our IP address. It lists both IPv6 and IPv4 addresses.

Important: When we examine our IP address, we may see the loopback word. It refers to an IP address that delivers traffic to a comparable system. The loopback address is commonly 127.0.0.1. Either we are analyzing at the erroneous line or we aren't connected to a network when we study the IP stated.

4. Find our IP Address using a GUI in Linux

If we are utilizing the point-and-click interface for operating our Linux system, we may verify our IP address by contemplating the following steps:

  1. Enter Settings inside the search bar of the Application Menu.
  2. Press on the icon, i.e., Settings that appears among the outputs.
  3. Then, search the tab, i.e., Network inside the Settings menu, and click on the icon, i.e., Advanced Wired Settings.
  4. It will open a pop-up window along with wired configuration information. Here we may verify both our IPv6 address and IPv4 address.

We may reach out to the external website for getting our public IP address.

If we are using any browser, we may travel to:

https://www.whatismyip.com

Or,

If we are using a terminal or command line, use the retrieval command such as wget or curl to reveal an external IP address.

wget -0 - -q https://checkip.amazonaws.com  
curl -s https://icanhazip.com  

Important: When we use curl for connecting to a website (insecure), the output will react with the error.

What is a Private/Public IP Address

In a network, all machines are required to have their IP address. It will generate issues on the network if two machines have a similar IP address.

Most of the contemporary networks will discover the problem and advise us to remedy it. Various older networks nevertheless can become humiliated, attempting to send data to both systems.

Most of the PCs will have two unique IP addresses which are as follows:

Public IP address: It is the address that encounters on a website if we are accessing it. Our system will connect to a router with the IP address (internal) when we join to any tiny network. In turn, the router connects to a big network (such as an Internet Service Provider) and it has its IP address system.

Private IP address: It is the IP address that is used on a network. It is also the one we will desire to utilize to set up the routing tools. Typically, the internal IP address originates with the 192.168.x.x IP address on the smaller networks. It is assigned to our system every time we join dynamically.

A few ranges of IPv4 addresses are designated for a private network. These are mentioned below:

192.168.0.0/16
172.16.0.0/12
10.0.0.0/18



About the author:
Pradeep has expertise in Linux, Go, Nginx, Apache, CyberSecurity, AppSec and various other technical areas. He has contributed to numerous publications and websites, providing his readers with insightful and informative content.