A public vs. a private IP address
Two types of IP addresses exist – public and private. While both of these types are necessary for devices to be able to communicate with each other, they have different purposes.
A public IP address is what allows data from the internet to reach your network. It’s essentially a unique identifier for your network, assigned to you by your internet service provider (ISP). Since the number of public IP addresses is limited, they are managed globally to ensure they are used efficiently to avoid shortages. This is where network address translation (NAT) comes into play. NAT allows your router to map multiple private IP addresses from devices in your internal network to a single public IP address. This process ensures that all your devices, like your phone, laptop, or tablet, can share the same public IP while accessing the internet. Without NAT, we wouldn’t have enough public IP addresses to go around, leading to IP conflicts and making it harder for devices to connect to the internet.
A private (or local) IP address, however, is used only within your local network, like your home or office network. It helps devices on the same network, like your computer, printer, and smart TV, to communicate with each other. Every device connected to your private network has its own unique local IP address, assigned automatically by your router. Unlike public IPs, private IP addresses are not accessible online and are specifically designated for internal use.
Why would you need to know your IP address on Linux?
Your private IP addresses are like the home addresses of all the devices within your local network. It allows other devices on the same network, like your printer or another computer, to find and connect to it. You will need your private IP address in situations like managing your network, fixing internet issues, and setting up services. For example, if your internet isn’t working, checking your IP can help identify whether your device has a valid network configuration. It’s also useful when setting up a server because other devices on your network will need a private IP address to connect to your Linux machine. Plus, checking your IP can help monitor your network to keep it secure and running smoothly.
Your public IP address connects your entire network to the internet. It acts like the front door to your network, letting devices and servers outside your home or office find and connect to it. Public IP is needed for tasks like hosting a website, accessing your network remotely, or sharing resources online. Without a public IP, your internal network wouldn’t be able to communicate with the rest of the internet.
How to find your private IP address on Linux
Finding your Linux computer's IP address is simple and doesn’t require any technical know-how. You can easily find it in just a few steps using the Linux graphical interface (GUI) or Terminal, whichever you prefer.
Using the Linux GUI
If you prefer using the graphical interface, finding your private IP address is quick and intuitive. Simply look for the “Network” icon in your taskbar (usually in the top-right or bottom-right corner of your desktop, depending on the Linux distribution) and hover your mouse over it. You’ll see a small pop-up with your current connection details, including your private IP address information.
You also can use your network settings and check your private IP address there:
- 1.Open the “Application” menu on your Linux desktop and type “settings” into the search bar.
- 2.Click “Settings” and go to the “Network” tab.
- 3.Choose your network adapter and click on the “Network options,” usually marked by a “Gear” icon. A pop-up window will open.
Your IP will be listed in the pop-up window, usually labeled as “IPv4 address.” If your network uses IPv6, you’ll also see an “IPv6 address” listed here. The difference between IPv6 and IPv4 is their size and format — IPv4 uses 32 bits for addresses, while IPv6 uses 128 bits, providing many more unique addresses.
Using Terminal
Those who prefer the command line can use the terminal to find your computer’s IP address on Linux. You can do so in two ways – using the “ip addr” command or the “ifconfig” command.
Both methods are like the Linux version of the Windows “ipconfig” command and will show your private IP, but the “ip” command is more common on modern Linux systems. It’s newer and offers more features. The “ifconfig” command is older and mostly used on older Linux distributions. But if you need to use the “ifconfig” command on a newer Linux for compatibility reasons or personal preference, you can do so. You just first need to install the necessary tools by running the “sudo apt install net-tools” command.
Here’s a step-by-step explanation of how to find your private IP via Terminal:
- 1.Open the “Terminal” window. Click on the “Terminal” icon on the desktop, search for it in your application menu, or press the “Ctrl” + “Alt” + “T” combination on your keyboard.
- 2.Type one of the commands to find out your private IP and press “Enter.” You can use one of the two commands:
- “ip addr”
- “Ifconfig”
- 3.Look for your active network interface (often named “eth0” for wired or “wlan0” for wireless) in the output. Your private IP will be listed next to “inet” (e.g., “inet 192.168.1.5/24”).
How to check your public IP address on Linux
Your public IP address is the unique identifier assigned to your network by your ISP, allowing it to connect to the internet. Finding it is easy and can be done using several methods. Let’s explore how to check your public IP address on Linux.
Using Web-based tools
One of the easiest ways to check your public IP address is to use an online IP checker tool. These services simply display your public IP address when you visit their websites. Various tools are available online. They are quick and easy to use but require an active internet connection to access the website. To find a web-based tool, follow these steps:
- 1.Open your preferred web browser.
- 2.Search for "What is my IP?" or "IP checker" in the search bar.
- 3.Click on one of the links provided.
- 4.The website will automatically show your public IP address on the page.
Using Terminal
If you prefer using the terminal, you can easily find your public IP address with a few commands:
- 1.Open the “Terminal” window. Press “Ctrl” + “Alt” + “T” on your keyboard, click on the “Terminal” icon on the desktop, or search for "Terminal" in your application menu to open the “Terminal” window.
- 2.Type in the command and press “Enter.” You can choose from three different commands to find your public IP address:
- The “curl ifconfig.me” command. This command retrieves your public IP by querying the “ifconfig.me” service.
- The “dig +short myip.opendns.com @resolver1.opendns.com” command. This command uses OpenDNS to return your public IP address. It's a good option if you're using OpenDNS as your DNS resolver.
- The “wget -qO- ifconfig.me” command. This command is similar to “curl,” but uses “wget” to fetch your IP from “ifconfig.me.” The “curl” command supports more types of protocols than “wget,” which supports only HTTP, HTTPS, and FTP. However, in this case, both will work just fine.
- 3.Look for your public IP address. After running any of the above commands, you’ll see a number that represents your public IP address. It will typically appear as a series of four numbers separated by dots (for example, “123.123.123.123”). This number is your external IP address, the one assigned to your network by your ISP.
Using GNOME desktop environment extensions
You can also check your public or private IP address on Linux using GNOME desktop environment extensions. These tools integrate directly into your desktop so you can easily monitor your network information, including your public and private IP, without needing to open a terminal or browser. Just be cautious to download extensions only from official sources to ensure your data remains secure.
Like what you’re reading?
Get the latest stories and announcements from NordVPN
We won’t spam and you will always have the choice to unsubscribe