About Me

header ads

[GUIDE] Finding the local and public IP address on Ubuntu 20.04

Ubuntu-20.04-Focal-Fossa-wallpaper-greyscale

In this mini-guide for beginners we will see how to check the local (public network IP) and public IP address both from the command line and through the graphical interface on Ubuntu 20.04 Focal Fossa, the latest Canonical LTS. But first, let's do a brief recap on what is an IP address and see what is the difference between IPv4 and IPv6.

IP addresses: IPv4 and IPv6

The Internet Protocol Address, in short, "IP address", represents the clearly identifiable address of a device (Eg a laptop) in an internal or external network. An IP address can also designate an entire group of devices, such as in the case of broadcasting or multicasting. Likewise, multiple addresses may be assigned to a single computer. What is certain is that, at any given moment, each IP address in a network can only be assigned once.

The addresses of the Internet Protocol Version 4 (in short: IPv4) consist of 32bit and therefore appear as a 32-digit binary number, for example, 11000100 10101000 10110010 01011111. This sequence is usually represented as a combination of four decimal numbers with values between 0 and 255, separated by dots. Example: 192.168.174.45. With IPv4, a total of around 4.3 billion different addresses can be formed. Few ever, considering that every inhabitant of the earth connects to the network with multiple devices. Since they are never used all at the same time and some are used only in private networks, their number has so far been sufficient.

To overcome the problem, which will explode with the arrival of the IoT, IPv6 has been introduced, which expands 340 sextillions (a number with 37 zeros), a practically inexhaustible reserve of IP addresses for all future needs. The addresses of this version are divided into eight blocks of 16 bits each, separated by colons. Thus, for example, the IPv6 address 0000: 0000: 0000: 0000: 0000: ffff: c0a8: b21f is obtained, where also the letters from a to f represent hexadecimal digits. By omitting the zeroes at the beginning of each block and replacing a series of consecutive 0000 blocks with two successive symbols of two points (: :) it is possible to further simplify this format. So in our case, we get the writing ::ffff:c0a8:b21f.

IP addresses on Ubuntu 20.04 Focal Fossa

Open the system settings and look for the Wi-Fi tab in the left panel and then click on the gear. A detail will appear with all the information you are looking for, including the IP address. Choose the Network item if you are connected to the cable network:

ubuntu-20.04-ip-addresses-768x498

Local IP Address via terminal

Alternatively, you can use the terminal. From command line give the following command:

ifconfig

If the terminal warns you that the command has not been recognized, you need to install some tools. To do so given this instruction: sudo apt install net-tools.

ubuntu-20.04-ip-addresses-1-768x498

Another command that allows you to achieve the same result is the following:

ip address

ip-address-ubuntu-768x257

Note: wired networks are usually indicated with eth0, eth1, eno1, while wireless networks are indicated with wlan0, wlan1, etc.

Public IP Address

The public IP address, or the address that identifies you on the network, can be found simply by searching for it on Google. There are specific sites that tell you what your address is. Alternatively, open the terminal and issue the following command:

curl https://ipinfo.io/ip

If you don't have curl you can install it using this command:

sudo apt install curl

Post a Comment

0 Comments