How to check your IP address on Linux: 12 steps (with pictures)

How to check your IP address on Linux: 12 steps (with pictures)
How to check your IP address on Linux: 12 steps (with pictures)
Anonim

You will sometimes need, in certain circumstances, to know the private IP address of your computer to connect to it from your network or the public IP address of your network which allows access from the outside. It is very easy to do this in Linux.

Steps

Method 1 of 2: Obtain the public IP address of your network

Understandmethod

Step 1. Know when to use your network's public address

The latter is the address that external services and websites will use to identify your network. If you want to connect to a device that is part of your network from an external access point to the latter, you must know its public IP address to do so.

Check the IP Address in Linux Step 9

Step 2. Open a terminal

Double-click on the icon symbolizing the control terminal of your system or simultaneously press the Ctrl + Alt + T keys to display it on your screen.

Check the IP Address in Linux Step 10

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

Enter

curl ifconfig.me in your terminal window. The function of this command is to display the public IP address of your computer that it will obtain from an external website.

Check the IP Address in Linux Step 11

Step 4. Press the Enter key on your keyboard

The command will run at this time.

Check the IP Address in Linux Step 12

Step 5. Wait for your public IP address to appear

The IP address that will appear will be that of your network, seen from the Internet or a third party network.

Method 2 of 2: Obtain your computer's private IP address

Understand5

Step 1. Know when to use your PC's private address

If you want to connect your new router or other equipment to your computer, you will need to know the IP address of the latter from your local network, whether wired or wireless.

Check the IP Address in Linux Step 2

Step 2. Open a terminal

Double-click the icon symbolizing the control terminal of your system or simultaneously press the Ctrl + Alt + T keys to display it on your screen.

Check the IP Address in Linux Step 3

Step 3. Enter the command to find the IP address

Enter ifconfig in the terminal window. There are many other commands to perform this query, including:

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

Step 4. Press the Enter key on your keyboard

The command will run and display all the IP addresses relating to the hardware connected to your local network, your computer included.

Check the IP Address in Linux Step 5

Step 5. Identify your computer's IP address

You will find it below the line starting with "wlo1" (for Wlan0) if you are connected via Wi-Fi, just after the key labeled "inet". If you are wired to your network, you will find this information under the line labeled "lo", just after the key named "inet".

Check the IP Address in Linux Step 6

Step 6. Write down your private IP address

The address you are interested in, expressed in IPv4, is located to the right of the key named "inet". This is the private IP address of your computer seen from the local network it is connected to and this is what you will need.

You can see your IPv6 address next to the "inet6" key. If you use IPv6 addressing on your local network, which is very rare on local networks, you will be interested in the address displayed to the right of the "inet6" key

Check the IP Address in Linux Step 7

Step 7. Try the hostname -I command

On some Linux distributions, such as Debian and its derivatives, you can directly display your PC's private IP address by entering the hostname -I command followed by pressing the Enter key. Note that the “I” flag used in this command is an uppercase “i” and not a lowercase “L”. To learn more about the options for this command, enter hostname - ?, hostname -h, or hostname --help in your terminal. More details will be brought to you by using the command

man hostname.

Advice

  • The private IP address of your computer is a series of numbers assigned to it in your local network, whether wireless or wired, while the public IP address is assigned to the head of your computer. network if it is connected to the Internet or to other networks interconnected by gateways.
  • Free software with a graphical interface, Angry IP Scanner, can be downloaded from the Internet and will allow you to view all the devices connected to your local network, including your computer, as well as to obtain certain information useful for administration. This practical and easy-to-use program is available for Linux, Mac and Windows.
  • Generally speaking, getting simplified help with Linux commands is done by entering the command, followed by a space and then the flag. -?, -h Where --help. If you want to get more details, just request the display of the order manual by entering man followed by a space then the name of the command without flag, like man hostname. The result of this display can be long, but will have the advantage of being more explanatory.

Popular by topic