How to Check the IP Address in Linux (in 3 Ways) [2022] | Abstract

A non-technical computer drug user may never realize the presence of an IP address. however, if you are a techie and want to tinker with the network shape and connectivity options of your calculator, then this post is for you. Let ’ s take a shot at Linux ‘s means of finding out the IP cover. An IP Address identifies a device on the Internet or the Local Area Network ( LAN ). It is configured at the net layer within the function system of a calculator. All applications running on the calculator and accessing other services over the Internet use the IP address to route data to and from the calculator. This is the distinctive client-server form of communication over the Internet, where the client application running on one computer addresses the server application running on another calculator, and frailty versa. Abstract ‘s suite of API ‘s are built to save you time. You do n’t need to be an expert in electronic mail establishment, IP geolocation, etc. Just concentrate on writing code that ‘s actually valuable for your app or business, and we ‘ll handle the rest .

Prerequisites for Getting a Linux IP address

This post applies to the most popular Linux-based distributions such as Ubuntu, Red Hat, Debian a well as Unix flavors. You will need a calculator running any of these flavors of Linux. alternatively, you can besides install Linux as a VM.

IP addresses in Linux are managed via a place of administration commands, via the command line terminal. Make sure you have a terminal window open.

Three Ways to Get Linux IP Address

ifconfig Command 

ifconfig is the most widely used command for checking the IP address associated with a Linux computer . This command lists all the IP addresses configured in the network layer of the calculator for each network interface. In the above screenshot, you can see two interfaces, “ ens5 ” and “ lo ”. The interfaces are configured with an IPv4 and IPv6 address, labeled as inet and inet6, respectively. The “ ens5 ” is the LAN interface of the computer with IPv4 address as, and IPv6 address as f680:855:55ff : fe32:92f6. By default, the “ lo ” interface is always set to which is a indicate address mean for routing internal traffic within the calculator, when both the customer and server applications are hosted on the same computer. This is besides known as a loopback address. This command besides provides stats about the number of packets transmitted, and received. additionally, it besides captures counts related to erroneous packet transfer, number of drop packets, overruns, and collisions .

ip address Command

The information science address command retrieves the IP address of the calculator . You can see both the IPv4 and IPv6 addresses listed for the LAN and loopback interface.

ip route command 

The information science route command is used to configure the routes for packets to and from the computer . The first entry of the instruction output signal shows the default route to the calculator IP address via the gateway.
note : Both information science address and information science route are separate of the information science command used for network presidency and can alter the network configuration of the Linux computer. If you are using them for anything other than reading the IP address, then make sure you understand all the command options. You are besides expected to be familiar with TCP & IP protocol .

Bonus Tip: Find your IP Address using a GUI in Linux

If you are using one of the desktop versions of Ubuntu Linux, you can besides check the IP address from the top left system menu where the Wi-Fi or Ethernet symbol is displayed .

What is a Public/Private IP Address?

broadly, IP addresses are of two types. Public and secret. Let ’ s understand this from a layman ’ mho perspective. A populace IP address is an address that identifies a device over the Internet. Therefore, any other device on the Internet can reach out to the device configured with a populace IP address. A private IP address identifies a device on an intranet of a local area network. The three commands that you saw above were the secret IP addresses of the computer. This distinction arises because the Internet is considered a public network, whereas a local area network is considered a private network belonging to an arrangement or a home. It is akin to the practice of public telephone numbers on the telephone / mobile network viz-a-viz, a local reference used to reach a call connected to an agency PBX or intercommunication system .

Major Difference between Public and Private Addresses

here are a few differences between public and private IP addresses. Allocation of IP Address Public IP addresses are allocated to internet service providers, which then lease them to internet subscribers. These addresses are assigned by the Internet Assigned Numbers Authority ( IANA ), a non-profit, standards organization that regulates and oversees the consumption of populace IP addresses. Private IP addresses are allocated by the net administrator of the LAN. It does not need the consent of IANA or third-party organizations. Address Numbering Limits private IP addresses have a pre-defined network prefix series, starting with 10, 172.16 to 172.31, and 192.166. The rules governing the use of individual IP addresses are defined in the RFC 1918, which is the Internet Engineering Task Force ’ s ( IETF ) specification, for maintaining the requirements for all protocols used for communication over the Internet. A public IP address can be in any roll within to, barring the private IP address, the localhost address, and a few reserve ones.

Activation Public IP addresses are activated based on autonomous systems, which is a coherent group of net prefixes for different Internet Service Provider ( ISP ) serving in assorted geographic regions. Due to the enormousness of the Internet, the routing information for reaching the IP address is managed via a branch hardening of routing protocols, such as the Broader Gateway Protocol ( BGP ), which takes time to propagate across the entire Internet. Therefore, activation of public IP addresses for an autonomous system takes some time, depending upon the route protocols. private IP addresses are activated on a computer connected to a LAN network. Because of its limited coverage, and the use of layer 2 MAC address, the activation of a private IP address is about clamant .

Finding Your Public IP Address

even though your Linux computer entirely has a individual IP address for accessing the Internet, it must be connected to LAN with a gateway that has a public IP address. In most cases, the gateway is a router, with LAN side and WAN side network interfaces having distinct individual and public IP addresses, respectively. It routes the packets across these two interfaces via a procedure of net address translation and serves all the computers in the LAN to connect to the Internet. hera are a few ways in which you can get the public IP address associated with your Linux computer. curl Command With the curl command, you can fetch your gateway ‘s public IP address from a few websites. These websites track the IP address of any incoming request and restitution that as an HTTP reply. Some of the popular websites for returning your pubic IP savoir-faire are : dig command The dig command is a DNS search utility. Querying for a DNS resolution with this control fetches the public IP address of the calculator . host command master of ceremonies is another utility program instruction for DNS lookups . IP address on browser ‍ If you have a desktop Linux system, you can check your public IP address by launching a web browser with the What is my IP address and location page .

Finding Additional Information Through the IP Address

apart from its chief purpose of routing network dealings, an IP address contains a lot of extra information. This applies to any public IP address. Based on the allocations to ISPs of specific regions in the worldly concern, you can extract geo-location and ISP specific data for every public IP address. Check out the Abstract IP Geolocation API to know more about a specific populace IP address .


What is an IP Address?

An IP savoir-faire is a multi-part, numeral formatted issue used for addressing a calculator in a TCP/IP network. It is available in IPv4 or IPv6 address formats. Every computer must have a private IP address for connecting to a LAN. For accessing the Internet, it can be assigned a public IP address directly or must be approachable to a gateway configured with a populace IP address.

How to check the IP address of a Linux system?

Linux system offers many commands for accessing the IP address-related details. One can use the ifconfig command, or the IP address command to know the IP address configured on the arrangement. additionally, using the curl up command, it is possible to fetch the public IP address of a Linux calculator through some websites, such as or

What is the difference between public and private IP addresses?

Public IP addresses are assigned to devices and computers that are directly connected to the Internet. They are approachable over the Internet, which means that any early calculator can reach the calculator configured with the public IP address over the Internet. These addresses are controlled by IANA and the local ISPs serving the assorted geographic regions. Private IP addresses are configured on the network interface of a computer that is attached to the LAN. They are approachable within the LAN, but not over the Internet .

source :
Category : Tutorial

Related Posts

Trả lời

Email của bạn sẽ không được hiển thị công khai.