X

What is my IP – on Ubuntu Linux

In this guide, I will show you how to find your IP address (private IP address and public IP address) on Ubuntu Linux. I will also cover the steps for an IP location lookup to get IP location of my ipaddress, this will also show my isp. The same steps will work on other Linux distributions like CentOS, Debian, Fedora, Linux Mint, and Rocky Linux. So let's get started with finding IP address Ubuntu.

What is an IP address?

Your web browser uses an IP address to recognize your device among millions of other devices on the Internet. A network-wide IP address is a web-based home address that uses IP addresses to communicate and locate one another. So how do IP addresses come into play when I enter a URL or domain name in my browser? Firstly, you input a website name in your browser. This website name (domain) gets then translated via a service named DNS to IP addresses. There are two different IP address versions in TCP/IP internet protocol in use today, the older one is named IPv4, which is a set of 4 numbers between 0 and 255, separated by dots, for example, 192.168.0.1. The other one is named IPv6. It consists of numbers and chars separated by double dots. For example 2001:0db8:85a3:0000:0000:7a2e:0270:7235

A public IP is one that is assigned to you by your internet service provider while a private IP (or local IP) is one that is routed in your local network only. In most cases, you get it by DHCP from your router, the router might also act as a proxy server. Having private IP addresses is not a must, systems like internet servers are connected to a public IP directly in most cases, so they just have a public IP address and no private IP address. IP addresses are used in the TCP/IP internet protocol to route internet traffic.

What your IP address can reveal about you and your location

Your IP address can reveal surprisingly much information regarding your current geo-location as IP addresses are assigned by ICANN to internet services providers and there exist geolocation databases where an IP has been assigned to. Also, the aggregation of IP addresses with metadata, cookie tracking, and browser-fingerprinting technologies allows web developers to build a detailed profile with a precise location. They can determine where and what pages of websites you visited, what you want and how you downloaded to, and who you speak with, and then offer you targeted information and advertising. Internet Service Providers may access further information which your IP address reveals.

Public vs private IP addresses

Contrary to public IP addresses private IP addresses are not routed on the public internet. There are several ranges of IP addresses that are reserved to be used in private networks only. These are the localhost IP range starting with 127 (example: 127.0.0.1). Other commonly reserved IP ranges are 10.* (e.g. 10.0.0.1) or 192.168.* (e.g. 192.168.0.1). These ranges are used in a private network only. All computers on your network use a different personal IP so they can connect directly to the other computers. No one outside the local network can see them. the mechanism to translate between public and private IP addresses is called NAT (Network address translation). In many cases, you get a new IP address each time your router or network device reconnects to the public network, this is called a dynamic IP address. Private IP addresses are assigned by your router using DHCP protocol on your LAN or wi-fi network, or you can assign them manually as well.

What is my private IP address?

So how to check my IP ubuntu, and what is my IP? Linux systems like Ubuntu have a bunch of tools on board to find out your private IP address. One of them is the command:

ifconfig

The result will look similar to this:

I've marked the IPv4 address in red and the IPv6 address in green in the screenshot.

What is my public IP address?

The public IP address is assigned to you by your internet service provider. It can also be a static IP assigned to you by a data center e.g. when you run a web server. There are several ways to look up the public IP:

  1. If you are looking up the public IP on a Linux server that is directly connected to the internet, then follow the instructions from above for looking up a private IP.
  2. If you are using a router e.g. in your home network, log in to the router control panel, and it will show you the public IP that your network is connected to.
  3. The third option is to use a service that helps you to look up your public IP. This is e.g. done by Google. Go to google.com and enter "what is my ip address" in the search form, Google will then show you your IP address as the first result.

Can you find location from IP address?

In this chapter, I will show you ways to find your IP location, also known as IP address location.

Run the following commands in your Ubuntu Terminal:

sudo apt update
sudo apt upgrade
sudo apt install curl jq

Now you can look up your IP address location using this curl whatismyip command:

curl https://ipinfo.io/<Public_IP_Address>

Replace <Public_IP_Address> with your public IPv4 or IPv6 address.

FAQForge:
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings