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.
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:
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.
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:
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 127.0.0.1. 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:
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.
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: