How to check IP address in Linux: 12 steps

Table of contents:

How to check IP address in Linux: 12 steps
How to check IP address in Linux: 12 steps
Anonim

This article will show you how to find the private and public IP address of a Linux computer.

Steps

Method 1 of 2: Find a Private IP Address

Step 1. Know when to use this method

If you need to find the IP address of a computer on a wireless network (for example, to redirect your computer's router), you need a private IP address.

Check the IP Address in Linux Step 2
Check the IP Address in Linux Step 2

Step 2. Start the terminal

Click or double click on the terminal icon or just press Ctrl + Alt + T.

Check the IP Address in Linux Step 3
Check the IP Address in Linux Step 3

Step 3. Enter the command to display the private IP address

Enter ifconfig in a terminal window. Other commands you can use:

  • ip addr
  • ip a
Check the IP Address in Linux Step 4
Check the IP Address in Linux Step 4

Step 4. Press ↵ Enter

The command will be executed, and the screen will display the IP addresses of all network elements, including your computer.

Check the IP Address in Linux Step 5
Check the IP Address in Linux Step 5

Step 5. Find the line with the computer's IP address

Typically this is a string with "wlo1" (or "wlan0"), with an "inet" tag to its right.

Check the IP Address in Linux Step 6
Check the IP Address in Linux Step 6

Step 6. Find your private IP address (IPv4 address)

It is located to the right of the "inet" tag. This is the IP address of a computer on the current network.

The IPv6 address can be found next to the "inet6" tag. IPv6 is not as widespread as IPv4

Check the IP Address in Linux Step 7
Check the IP Address in Linux Step 7

Step 7. Try entering the "hostname" command

On some versions of Linux, such as Ubuntu, you can find the IP address of your computer by typing hostname -I (this is an uppercase "i", not a lowercase "L") and pressing ↵ Enter.

Method 2 of 2: Find a Public IP Address

Step 1. Know when to use this method

A public IP address is the address that websites and online services “see” when you open them on your computer. If you want to connect to your computer from another computer that is on a different network, you will need a public IP address.

Check the IP Address in Linux Step 9
Check the IP Address in Linux Step 9

Step 2. Start the terminal

Click or double click on the terminal icon or just press Ctrl + Alt + T.

Check the IP Address in Linux Step 10
Check the IP Address in Linux Step 10

Step 3. Enter the command to display the public IP address

Enter curl ifconfig.me in terminal. This command will get the public IP address from the website.

Check the IP Address in Linux Step 11
Check the IP Address in Linux Step 11

Step 4. Press ↵ Enter

The command will be executed.

Check the IP Address in Linux Step 12
Check the IP Address in Linux Step 12

Step 5. Find your public IP address

The IP address that appears under the entered command is the public IP address of your network.

Advice

The private IP address is the address assigned to your computer on your wireless network, and the public IP address is the address assigned to your network

Popular by topic