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 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 172.31.12.224, and IPv6 address as f680:855:55ff : fe32:92f6. By default, the “ lo ” interface is always set to 127.0.0.1 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 0.0.0.0 to 255.255.255.255, barring the private IP address, the localhost address, and a few reserve ones.
Read more : 3 Key Steps to a Concrete Floor Refresh
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 : icanhazip.com ifconfig.me ipinfo.io/ip 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.
Read more : How to Lower Your Electric Bill – NerdWallet
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 ifconfig.me or icanhazip.com
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 .