Skip to Content

How to Find Your IP Address in Ubuntu Linux

If you’re having trouble connecting to the internet or other devices on the network, checking your IP address can help you determine if the issue is related to your network configuration.

The ip addr command is used to display information about network interfaces and their associated IP addresses on a Ubuntu system.

In this article, I will share how to find your IP address in Ubuntu Linux with this command.

What is IP address?

Before I jump to the topic,  it is necessary for us to know what an IP address is.

An IP address (Internet Protocol address) is a unique numerical label assigned to each device connected to a computer network that uses the Internet Protocol for communication. In Linux, the IP address is used to identify a network interface on a computer and to route network packets to their destination.

Furthermore, it should be noted that there are two types of IP addresses: IPv4 and IPv6.

IPv4 addresses are represented by four sets of numbers separated by periods, for example, 192.168.1.1. IPv6 addresses are represented by eight sets of numbers separated by colons, for example, 2001:0db8:85a3:0000:0000:8a2e:0370:7334.

How to find ip address in Ubuntu Linux?

To check your IP address in Ubuntu Linux, we can use the ip addr command.

  • Open Terminal: Click on the search icon on the top left corner of the screen and type “Terminal” in the search bar. Then, click on the Terminal icon that appears in the search results.
  • Run the ip addr show command: In the Terminal, type “ip addr” and press the Enter key. This command displays the network configuration of your computer, including information about the IP address.
  • Find the IP address: Look for the line that starts with “inet” The number next to “inet” is your IP address.

 

From my experience, ip command is a valuable tool for working with network configuration.

It can show you detailed information about your IP address and other networking parameters, and it allows you to change settings on the fly which makes it very useful.

Additionally, ip command has several options that allow users to modify their network interfaces in a more granular way, allowing for greater control over their network settings.

The ip addr command is part of the iproute2 package, which is typically installed by default in most modern distributions of Linux, including Ubuntu.

You can verify whether it’s installed on your system by running the following command in the terminal:

ip --version

If it’s installed, you’ll see output indicating the version of the iproute2 package that’s installed on your system.

If it’s not installed, you can install it by running the following command:

sudo apt-get update
sudo apt-get install iproute2

To learn more about ip command, I highly recommend the following article.

3 useful Linux ip commands you need to know about networking

Example of ip addr command in Ubuntu

Here’s an example of what the output of the “ip addr” command look like in Ubuntu:

$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:0c:29:1b:37:a7 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.100/24 brd 192.168.0.255 scope global dynamic noprefixroute eth0
valid_lft 86416sec preferred_lft 86416sec
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:26:5e:4d:99:af brd ff:ff:ff:ff:ff:ff
inet 192.168.1.108/24 brd 192.168.1.255 scope global dynamic noprefixroute wlan0
valid_lft 86416sec preferred_lft 86416sec

In this example, the computer has two network interfaces: eth0 (Ethernet) and wlan0 (Wi-Fi).

The IP addresses for each interface are listed next to “inet”. In this case, the IP address for eth0 is 192.168.0.100 and the IP address for wlan0 is 192.168.1.108.

Find ip address for a specific network interface in Ubuntu

If you run the command without specifying the interface option, it will display information about all network interfaces.

If you specify an interface (such as eth0), it will display information only for that particular interface.

Let’s say if I want to get the ip address of interface eth0, I will use the following command.

ip addr show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:11:22:33:44:55 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.100/24 brd 192.168.1.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::211:22ff:fe33:4455/64 scope link
valid_lft forever preferred_lft forever

4 Ways to check Ubuntu Version

3 Ways to Find MAC Address in Ubuntu Linux

Step by Step Guide to troubleshoot network issue in Linux