- How to Check Your IP Address in Ubuntu [Beginner’s Tip]
- What is an IP Address?
- Checking your IP Address in Ubuntu [Terminal Method]
- Just get the IP address
- Checking IP address in Ubuntu [GUI Method]
- Bonus Tip: Checking your public IP address (for desktop computers)
- Summary
- Hidden Features! 25 Fun Things You Can Do With DuckDuckGo Search Engine
- What is TTY in Linux?
- Beautifully Monitor CPU Utilization in Linux Terminal With Stress Terminal UI
- How to Access the GRUB Menu in Virtual Machine
- FOSS Weekly #23.28: China’s Linux OS, Linux Exit Codes, Btrfs Origins and More
- Using cp Command in Linux
- Become a Better Linux User
- Find your IP address
- Find your wired connection’s internal (network) IP address
- Find your wireless connection’s internal (network) IP address
- Find your external (internet) IP address
- More Information
- See Also
- Как узнать IP адрес, используя командную строку Linux
- Определяем IP-адрес командой ip
- Определяем IP-адрес командой hostname
- Через графическую утилиту
- Определение своего IP-адреса
- Определение своего внутреннего IP-адреса (в локальной сети)
- Определение своего внутреннего IP-адреса (в локальной сети)
- Определение своего внешнего IP-адреса (в Интернете)
- Дополнительная информация
- Смотрите также
How to Check Your IP Address in Ubuntu [Beginner’s Tip]
Wonder what’s your IP address? Here are several ways to check IP address in Ubuntu and other Linux distributions.
Wonder what’s your IP address? Here are several ways to check IP addresses in Ubuntu and other Linux distributions. Want to know your Linux system’s IP address? You can use the ip command with the option a like this:
The output is extensive and it shows all the internet interfaces available, including loopback. Identifying the IP address could seem challenging if you are new to it.
1: lo: 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 inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: enx747827c86d70: mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000 link/ether 74:78:27:c8:6d:70 brd ff:ff:ff:ff:ff:ff 3: wlp0s20f3: mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether dc:41:a9:fb:7a:c0 brd ff:ff:ff:ff:ff:ff inet 192.168.1.53/24 brd 192.168.1.255 scope global dynamic noprefixroute wlp0s20f3 valid_lft 82827sec preferred_lft 82827sec inet6 fe80::e1d:d71b:c507:5cc8/64 scope link noprefixroute valid_lft forever preferred_lft forever
It really is not, actually. And there are other ways to find the IP address. I’ll discuss all this in detail. But first, let’s brush up the basics.
What is an IP Address?
An Internet Protocol address (commonly referred to as the IP address) is a numerical label assigned to each device connected to a computer network (using the Internet Protocol). An IP address serves both the purpose of identification and localisation of a machine.
The IP address is unique within the network, allowing communication between all connected devices.
You should also know that there are two types of IP addresses: public and private. The public IP address is used to communicate over the Internet, the same way your physical address is used for postal mail. However, in the context of a local network (such as a home where a router is used), each device is assigned a unique private IP address within this sub-network. This is used inside this local network without directly exposing the public IP (which the router uses to communicate with the Internet).
Another distinction can be made between IPv4 and IPv6 protocols. IPv4 is the classic IP format, consisting of a basic 4-part structure, with four bytes separated by dots (e.g., 127.0.0.1). However, with the growing number of devices, IPv4 will soon be unable to offer enough addresses. This is why IPv6 was invented, a format that uses 128-bit addresses (compared to the 32-bit IPv4).
Checking your IP Address in Ubuntu [Terminal Method]
The fastest and simplest way to check your IP address is by using the ip command. You can use this command in the following fashion:
Both commands show the same output. They will show you both IPv4 and IPv6 addresses: You should identify the correct interface and then look beside inet for IPv4 and inet6 for IPv6. For example, inet 192.168.1.53/24 means the IPv4 address is 192.168.1.53.
Just get the IP address
It will just give the IP address of the system. Nothing else. There are other ways to check IP addresses in Linux but these two commands are more than enough to serve the purpose.
Long-time users might be tempted to use ifconfig (part of net-tools), but that command is deprecated. Some newer Linux distributions don’t include this package anymore and if you try running it, you’ll see the ifconfig command not found error.
Checking IP address in Ubuntu [GUI Method]
If you are not comfortable with the command line, you can also check the IP address graphically. Open up the Ubuntu Applications Menu (Show Applications in the bottom-left corner of the screen) and search for Settings and click on the icon: This should open up the Settings Menu. Go to Network: Pressing on the gear icon next to your connection should open up a window with more settings and information about your link to the network, including your IP address: You can see the IP address of your router as well in the above screenshot. It’s displayed with “Default Route”.
Bonus Tip: Checking your public IP address (for desktop computers)
First of all, to check your public IP address (used for communicating with servers etc.) you can use the curl command. Open up a terminal and enter the following command:
This should simply return your IP address with no additional bulk information. I would recommend being careful when sharing this address since it is equivalent to giving out your personal address.
If curl isn’t installed on your system, simply use sudo apt install curl -y to install curl on Ubuntu-based Linux distributions.
Another simple way you can see your public IP address is by searching for the IP address on Google.
Summary
Here’s a summary of the commands you learned:
Description | Command |
---|---|
Show both IPv4 and IPv6 addresses with ip command | ip a or ip addr show |
Print only IP address using hostname command | hostname -I |
To check your public IP address (Need curl installed) | curl ifconfig.me |
Display IP Address with Network Manager tool | nmcli -p device show |
Use the ifconfig command to display the IP address (Need net-tools installed ) | ifconfig -a |
Now that you know your system’s IP address, how about getting the gateway IP? Boost your Linux networking skills with these essential commands! In this article, I went through the different ways you can find your IP address in Ubuntu Linux, as well as gave you a basic overview of what IP addresses are used for and why they are so important to us. I also discussed IPv4 and IPv6 briefly. By the way, have you ever wondered why there is no IPv5? I hope you enjoyed this quick guide. Let us know if you found this explanation helpful in the comments section!
Hidden Features! 25 Fun Things You Can Do With DuckDuckGo Search Engine
What is TTY in Linux?
Beautifully Monitor CPU Utilization in Linux Terminal With Stress Terminal UI
How to Access the GRUB Menu in Virtual Machine
FOSS Weekly #23.28: China’s Linux OS, Linux Exit Codes, Btrfs Origins and More
Using cp Command in Linux
Become a Better Linux User
With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world
Find your IP address
Knowing your IP address can help you troubleshoot problems with your internet connection. You may be surprised to learn that you have two IP addresses: an IP address for your computer on the internal network and an IP address for your computer on the internet.
Find your wired connection’s internal (network) IP address
- Open the Activities overview and start typing Settings .
- Click on Settings .
- Click on Network in the sidebar to open the panel.
If more than one type of wired connected is available, you might see names like PCI Ethernet or USB Ethernet instead of Wired .
Find your wireless connection’s internal (network) IP address
- Open the Activities overview and start typing Settings .
- Click on Settings .
- Click on Wi-Fi in the sidebar to open the panel.
- Click the button next to the active connection for the IP address and other details.
Find your external (internet) IP address
Depending on how your computer connects to the internet, the internal and external addresses may be the same.
More Information
See Also
- Create a connection with a fixed IP address — Using a static IP address can make it easier to provide some network services from your computer.
- What is an IP address? — An IP Address is like a phone number for your computer.
You can choose the displayed language by adding a language suffix to the web address so it ends with e.g. .html.en or .html.de.
If the web address has no language suffix, the preferred language specified in your web browser’s settings is used. For your convenience:
[ Change to English Language | Change to Browser’s Preferred Language ]
The material in this document is available under a free license, see Legal for details.
For information on contributing see the Ubuntu Documentation Team wiki page. To report errors in this documentation, file a bug.
Как узнать IP адрес, используя командную строку Linux
Раньше для просмотра текущих сетевых интерфейсов и их параметров (включая IP-адреса), использовалась команда ifconfig. Но она уже несколько лет как устарела, и в современных дистрибутивах Linux не поддерживается.
Вместо ifconfig рекомендуется использовать команду ip
Определяем IP-адрес командой ip
Чтобы определить IP-адрес вашего сетевого интерфейса можно использовать команду ip address (или эквивалентный вызов ip addr или просто ip a ).
ip address 1: lo: 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 inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: enp2s0: mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 00:24:1d:83:da:25 brd ff:ff:ff:ff:ff:ff inet 192.168.2.2/24 brd 192.168.2.255 scope global dynamic noprefixroute enp2s0 valid_lft 76434sec preferred_lft 76434sec inet6 fe80::1f6e:e0e4:27d1:e643/64 scope link noprefixroute valid_lft forever preferred_lft forever
В результате выполнения команды на экран будет выведен список текущих сетевых интерфейсов и их параметры. Первый интерфейс в списке обычно lo — это loopback интерфейс (нас он сейчас не интересует). Нас интересует Ethernet-интерфейс или WiFi-интерфейс (в зависимости от того, какое у вас подключение).
Ethernet интерфейсы обычно имеют имена вида enp2s0 или eth0, а WiFi-интерфейсы имеют имена вида wlp2s0 или wlan0 (цифры в названии могут отличаться).
Найдите интересующий вас интерфейс в списке. Его IP-адрес выводится на строке inet ..
В нашем примере это inet 192.168.2.2/24 . 192.168.2.2 — это IP-адрес. 24 — это маска подсети, соответствующая маске 255.255.255.0.
Определяем IP-адрес командой hostname
Воспользуемся командой hostname , чтобы вывести IP-адрес. Используем ключ -I
Команда выводит все сетевые адреса хоста (системы), кроме loopback интерфейса. Если у вас всего одно сетевое соединение, то, скорее всего, будет выведен один IP-адрес.
Через графическую утилиту
Хотя эта заметка рассматривает способы определения IP-адреса через командную строку, иногда проще посмотреть текущий IP-адрес через графические программы. В Ubuntu Linux это можно сделать в Параметрах системы в разделе Сеть .
Определение своего IP-адреса
Знание своего IP-адреса может помочь в решении некоторых проблем с подключением к Интернету. Возможно, вас удивит то, что у вашего компьютера два IP-адреса: IP-адрес компьютера в локальной сети и IP-адрес в Интернете.
Определение своего внутреннего IP-адреса (в локальной сети)
- Откройте Обзор и начните вводить: Настройки .
- Нажмите на Настройки .
- Нажмите Сеть на боковой панели, чтобы открыть этот раздел настроек.
Если доступно более одного типа проводного подключения, вы можете увидеть такие названия, как PCI Ethernet или USB Ethernet вместо Проводное .
Определение своего внутреннего IP-адреса (в локальной сети)
- Откройте Обзор и начните вводить: Настройки .
- Нажмите на Настройки .
- Нажмите Wi-Fi на боковой панели, чтобы открыть этот раздел настроек.
- Нажмите кнопку рядом с активным подключением, чтобы узнать IP-адрес и другие сведения.
Определение своего внешнего IP-адреса (в Интернете)
В зависимости от способа подключения вашего компьютера к интернету, внутренний и внешний адреса могут быть одинаковыми.
Дополнительная информация
Смотрите также
- Создание соединения с фиксированным IP-адресом — Использование статического IP-адреса может упростить предоставление компьютером некоторых сетевых услуг.
- Что такое IP-адрес? — IP-адрес — что-то вроде телефонного номера вашего компьютера.
You can choose the displayed language by adding a language suffix to the web address so it ends with e.g. .html.en or .html.de.
If the web address has no language suffix, the preferred language specified in your web browser’s settings is used. For your convenience:
[ Change to English Language | Change to Browser’s Preferred Language ]
The material in this document is available under a free license, see Legal for details.
For information on contributing see the Ubuntu Documentation Team wiki page. To report errors in this documentation, file a bug.