This article shows you how to find the local and public IP address of a computer using the Linux operating system.
Steps
Method 1 of 2: Find the Public IP Address
Step 1. Find out when to use this procedure
The public IP address is the address of your computer that is displayed by websites and web services when you browse the internet. If you need to connect to another computer remotely (i.e. to a machine that is not on the same LAN as your computer), you will need to use the public IP address.
Step 2. Open a "Terminal" window
Select or double-click the "Terminal" application icon or press the key combination Ctrl + Alt + T.
Step 3. Use the command to find the public IP address of the LAN you are connected to
Type the command curl ifconfig.me inside the "Terminal" window. This command will find the public IP address of the local network using a web service.
Step 4. Press the Enter key to execute the command
Step 5. Wait for the public IP address of the computer to appear on the screen
The series of numbers that will appear under the command you just entered represents the public IP address of your LAN.
Method 2 of 2: Find the Local IP Address
Step 1. Find out when to use this procedure
If you need to trace the IP address of the computer when it is connected to a Wi-Fi or Ethernet network (for example to activate the port forwarding rules of the router), you will have to refer to the local IP address of the machine you are on. working.
Step 2. Open a "Terminal" window
Select or double-click the "Terminal" application icon or press the key combination Ctrl + Alt + T.
Step 3. Use the command to view the computer's IP address
Type the ifconfig command in the "Terminal" window. Alternatively you can use one of the following commands:
- ip addr;
- ip a.
Step 4. Press the Enter key
In this way, the command entered will be executed by the operating system and the IP address of all the network interfaces present will be shown on the screen, including the one in use by the computer.
Step 5. Find your computer information
Normally you will have to refer to the network interface identified by the words "wlo1" (or "wlan0") placed to the right of the "inet" tag.
Step 6. Examine the computer's IP address
The IPv4 address is displayed to the right of the "inet" tag. This is the network IP address that has been assigned to the computer by the router.
The IPv6 address is displayed next to the "inet6" entry but is less used than the normal IPv4 address
Step 7. Try using the "hostname" command
Some versions of Linux, such as Ubuntu, allow you to trace your computer's network IP address using the hostname -I command and pressing the Enter button.