Javatpoint Logo
Javatpoint Logo

Find IP Address in Linux


The IP addresses are a code name that is assigned to a system on a network. It operates as the postal address which is providing network traffic is transferred to the correct system.

An IP address (or Internet Protocol Address) is a numerical label allotted to all devices linked to a system network. An IP address provides both localization and identification of a device. The IP is unique in the network, permitting communication between every connected device. Also, we should know that two types of different IP addresses are available: private and public.

Another distinction could be made between IPv6 and IPv4. IPv4 is the standard IP format, composed of a common 4-part structure, along with 4 bytes isolated by dots (e.g., In the set, all numbers can range from 0-255. Hence, the complete range of IP addressing goes from However, IPv4 will be unable soon to provide enough addresses with the increasing number of machines.

So, IPv6 was developed, a format that utilizes 128-bit addresses. IPv6 was to save us from a shortage of unique IP addresses, as the number of machines linked to the internet keeps enhancing by the day.

  • Another way is also there to categorize several IP addresses on the basis of whether it is Dynamic or static.
  • If our system has a Static IP, it means that this IP address of our system will always be the same.
  • Besides, each time we link to the internet, our IP address will remain the same.
  • If our system has a Dynamic IP, it will likely change.
  • DHCP (or Dynamic Host Configuration Protocol) is liable for selecting dynamic IP addresses.
  • Almost every machine on the internet, and most possibly ours too, has a dynamic IP address as they're the most effective cost option.
  • IP addresses aren't random. Mathematically, they are produced and assigned by the IANA (Internet Assigned Numbers Authority), a distribution of the ICANN (Internet Corporation for Assigned Names and Numbers).

ICANN can be described as a non-profit enterprise that was created in 1998 in the United States to support maintaining internet security and enable it to be accessible by all. On the internet, anyone who registers any domain experience a domain name registrar each time, who pays a fee to register that domain to ICANN.

Working of IP Address

If we wish to understand why a specific device isn't connecting in a way we would expect or wish to troubleshoot why our network is not working, it will help in understanding how an IP address works.

IP works similarly to other languages by interacting with guideline sets to convey information. Every device finds, transfers, and exchanges data with other LinkedIn devices with the help of this protocol.

Typically, the usage of IP addresses happens at the heels of the scenes. This process works as follows:

  • Indirectly, our device links to the internet at first by connecting to a network linked to the internet, granting our device approach to the internet.
  • Probably, that network will be our ISP (Internet Service Provider) when we are home. It will be our company network at work.
  • Our IP address is allocated to our device by our ISP.
  • Our internet activity experiences the ISP; they return it to us with our IP address. It's their job to allocate an IP address to our device because they're providing us access to the internet.
  • Our IP address can, however, change. For instance, turning our router or modem on or off can modify. We can also contact our ISP; they can modify it for us.
  • When we are out, for instance, and we take our device with us, our home IP address doesn't come with us. It is because we will be using other networks to use the internet and using a different IP address allocated to us by the ISP, such as the coffee shop, airport, or hotel.

IP Address Types

There are many categories of IP addresses and different types in each category:

  • Consumer IP address
    All businesses and individuals have two different IP addresses with the internet service plan: public and private. The public and private terms are associated with the network location, i.e., a private IP address is utilized in a network. Still, a public IP address is utilized in a network externally.
  • Private IP address
    All devices have a private IP address that connects to our internet network. It contains tablets, smartphones, and computers but also Bluetooth-enabled devices, such as smart TVs, printers, or speakers. With the developing IoT, the total of private IP addresses we have is probably developing at home.
    Our router requires a way to separately recognize these items, and several items require a way to identify each other. Hence, our router produces private IP addresses, and these are unique identifiers for all devices that separate them over the network.
  • Public IP address
    This address is the main address related to our whole network. Also, they are added to the primary IP address of our network, while all connected devices have their IP address. Our public IP address is given to our router through our ISP.
    ISPs typically include a major group of IP addresses, and they share with their customers. Our public IP address is an address that every device will use to identify our network outside our internet network.
    Public IP addresses are divided into two different types- static and dynamic.
    • Static IP addresses
      Static IP addresses will be consistent as opposed to dynamic addresses. An IP address will be the same once a network allocates it. Most businesses and individuals don't require a static IP address; however, for businesses that are supposed to host their servers, it's important to have one. It is due to a static IP address guarantees that email addresses and websites fixed to it will include a steady IP address. It is important if we wish other devices can find them on the web consistently.
      It leads to our next point. There are two different forms of website IP addresses. For website holders who do not host their server and rather depend on a hosting package of the web- which is the situation for almost all websites- two types of IP addresses for websites are available, which are listed and explained below:
      • Shared IP addresses
        Many websites that depend on shared hosting schemes will be one of several websites hosted on a similar server from web hosting providers. It tends to be the situation for SME websites or individual websites, in which traffic volumes are convenient, and the sites are restricted in terms of the total of pages, etc. Websites hosted will contain shared IP addresses in this way.
      • Dedicated IP addresses
        A few web hosting schemes include the option to buy a dedicated IP address. It can make getting an SSL certificate much easier and permits us to execute our FTP (File Transfer Protocol) server. It makes it convenient to transfer and share files with two or more people inside an organization and permits anonymous sharing options of FTP.
        Also, a dedicated IP address to access our website with IP address permits us to access our website with the IP address instead of the domain name- helpful if we wish to establish and check it before registering our domain.
    • Dynamic IP addresses
      Automatically, these IP addresses regularly change. ISPs buy a major group of IP addresses and allocate them to their customers automatically. They reallocate them and set the previous IP addresses back in the group to be utilized for other customers periodically. For the ISPs, the rationale is to produce cost savings for this approach.
      For example, automating the continuous flow of IP addresses means that they do not need to carry out particular tasks to re-create an IP address of a customer if they change home. There are also many security benefits due to a modifying IP address makes it complex for hackers to hack into our network interface.

Security threats of IP addresses

  • Online stalking- Many criminals can find our IP address by hardly stalking our online activity. Once they have our IP address, hackers can go to the tracking websites of an IP address like com, input it in, and get an idea of our location. Then, they can cross-reference the open-source data when they wish to approve whether an IP address is related to us exactly. Then, they can use Facebook, LinkedIn, or many social networks that display where we live and find out if that is the same as the given area.
  • Download prohibited content with our IP address- Attackers are known to utilize hacked IP addresses to get prohibited content or other things.
  • Track down our location- Attackers can utilize geolocation technology to recognize our state, city, and region. They just require doing a bit more research on social media to recognize our home and interrupt it potentially if they know we are away.


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

Find our IP address using Command Line

There are some different commands we can use for checking our IP address. We can begin by opening a command line/terminal window to execute these commands.

1. With the hostname command

From the terminal window, we can check our IP address with the help of the following command:

Find IP Address in Linux

Our system will show the internal IP address.

2. With the ip addr Command

We can check our IP address by using a command, i.e., ip addr.

Find IP Address in Linux

Our system will scan our hardware and show 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:

These entries will contain one for a wireless or WiFi adapter or wired or Ethernet adapter. Also, we may have the entry for the virtual adapter. Only one entry will generally have the IP address listed which is the one we will wish.

Important: The digit after the slash /64 -- and --/24 represents the network size. Also, it helps with mapping and scanning the size of the network.

3. With the ifconfig Command

This method is used for finding our IP address associates applying the ifconfig command. Type the following command in this command line:

Find IP Address in Linux

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

Important: When we check our IP address, we may notice the loopback term. It refers to an IP address that gives traffic to a similar system. The loopback address is usually Either we are examining at the inaccurate line or we aren't connected to a network when we examine that address listed.

4. Find our IP Address using a GUI in Linux

If we are using the point-and-click interface for running our Linux system, we can check our IP address by considering the following steps:

  • Enter Settings within the search bar of the Application Menu.
  • Press on the icon, i.e., Settings that appears among the outputs.
  • Then, search the tab, i.e., Network within the Settings Menu, and press on the icon, i.e., Advanced Wired Settings.
  • It will open a pop-up window along with wired settings details. Here we can check both our IPv6 address and IPv4 address.

Check Public IP Address

We can reach out to the external website for finding our public IP address.

If we are using any browser, we can navigate to:


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

Find IP Address in Linux

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

What is a Private/Public IP Address

In a network, all computers are needed to have their IP address. It will introduce errors on the network if two computers have a similar IP address.

Most of the modern networks will find the issue and prompt us to fix it. Various older networks however might get mortified, trying to route traffic to both systems.

Most of the computers will have two distinct IP addresses which are as follows:

Public IP address: It is the address that encounters on a website if we are visiting it. Our system will connect to a router with the IP address (internal) when we connect to any small network. In turn, that router connects to a huge 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 wish to use to configure the routing tools. Typically, the internal IP address commences with the 192.168.x.x IP address on the smaller networks. It is assigned to our system whenever we connect dynamically.

A few ranges of IPv4 addresses are reserved for a private network. These are listed below:


Next TopicLinux date Command

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA