Ever wonder where your computer lives on the Internet?
Like your home address, your system also has a digital address known as an IP address — a unique set of numbers that identifies your device on a network. Whether you’re new to Linux or just need a quick reminder, discovering your IP address is a common task that admins carry out frequently.
Knowing your IP address is crucial for all networking activities, including connecting to a device or a network, troubleshooting network issues, and configuring software.
This easy-to-follow guide will walk you through the simple steps to locate your IP address in a Linux environment. We’ll discuss four ways you can find your ip address.
Table of Content
- Find the IP Address From the Command line
- Types of IP Addresses
Find the IP Address From the Command line
We’ll start by exploring four easy methods for checking IP addresses.
Method #1: Check the IP Address with the hostname Command
Launch the terminal and enter the following command:
The -i flag tells the hostname command to display the machine’s IP address.
Here’s the output:
Method #2: Check the IP Address with the ip addr Command
The next method uses the ip addr or ip addr show command in the terminal:
# ip addr
ip addr provides detailed information about the ways your device is connected to the Internet.
For instance, you can see IPv4 address in the inet entry (inet 127.0.1.1/26) and IPv6 addresses in the inet6 entry (inet6 fe80::4c2:2bfb:fe0b:cd2e/64).
Method #3: Check the IP Address with the ifconfig Command
Another way to check your IP address is the ifconfig command in the terminal:
The output will show all network connections, whether active, inactive, or virtual. To find your IP address, look for the entry that says UP, BROADCAST, RUNNING, MULTICAST
You can see the IPv4 and IPv6 addresses. You can also see the interface names, such as eno1 or eth0.
Method #4: Check the IP Address in Linux From the GUI
If you have a GUI on your Linux server, you can find out the system’s IP addresses by following these steps:
Go to Settings:
and choose Advanced Wired Settings from the Network section:
A new window with details about your wired connection settings will pop up. Look for your IP addresses under IPv4 Address and IPv6 Address:
Types of IP Addresses
IP addresses can be divided on the basis of format and accessibility.
IP Addresses by Format
IP addresses are available in the following two major formats – IPv4 and IPv6.
- An older and more common IP address.
- Contains four sets of numbers in this format: 000.000.000.000
- Each set ranges from 0 to 255.
- There can be about 4 billion possible IPV4 addresses.
- IPv4 addresses are used for most devices and websites connected to the Internet.
- Newer and advanced IP address type.
- Solves the issue of the impending shortage of IPv4 addresses.
- Contains numbers and letters like: 2001:0db8:85a3:0000:0000:8a2e:0370:7334.
- IPv6 offers an incredibly large number of unique IP addresses.
IP Addresses by Accessibility
Every computer on a network needs a unique IP address because network conflict can arise if two computers share the same IP address.
Newer network configurations can sort this out and ask you to fix it. But some older systems might mix it up and try to send a packet to two addresses. Most systems have public and private addresses to avoid this scenario.
Private IP Address
- The private IP address is used within the network.
- It often starts with 192.168.x.x.
- Your computer gets a private IP address assigned automatically in smaller networks.
Public IP Address
- The public IP address is seen by websites when you visit them.
To summarize, private IP addresses are like home addresses within your network, while public IP addresses are like your home address on the global Internet.
How to Check Your Public IP Address
You can do a simple Google search and access several popular online platforms that display your public IP address.
If you prefer using the command line or terminal, just type this command:
# curl -s https://icanhazip.com
It’s like asking the Internet, “What’s my address out here?” and getting a quick answer! Here’s the output:
In this guide, you’ve learned how to find your IP address on a Linux computer. It’s like discovering your computer’s unique address on the Internet.
Knowing your IP address can be helpful for various purposes. You can connect with other devices, troubleshoot network issues, or configure software.
We provide excellent bare metal servers, instant dedicated servers, and 10 Gbps dedicated servers. So, whether you want to secure your website, enhance performance, or explore more about our versatile services, RedSwitches is there to help you excel.
Q. How can I find my IP address in Linux using the command line?
To find your IP address in Linux, you can use any of these commands: ip address show or ifconfig. These commands will display information about your network interfaces, including the IP addresses assigned to them.
Q. What is a public IP address?
A public IP address is assigned to your device by your internet service provider (ISP) that allows you to communicate with other devices and servers on the Internet.
Q. What is a private IP address?
A private IP address is assigned to your device on a local network, such as your home or office network. It allows your device to communicate with other devices within the same network.
Q. How can I find my public IP address in Linux?
To find your public IP address in Linux, use the next-mentioned command: curl ifconfig.me. It’ll retrieve your public IP address from a web service.
Q. What is the difference between a public and private IP address?
A public IP address is used for communication between devices on the internet, while a private IP address is used for communication within a local network.
Q. How can I check my IP address in Ubuntu?
To check your IP address in Ubuntu using the command line, you can use the following command: ip address show or ifconfig. These commands will display information about your network interfaces, including the IP addresses assigned to them.