Get Public and Private IP in Kali Linux

In this tutorial, we will learn how to get the information of our private and public IP addresses on Kali Linux via command line terminal and GUI.

If you’re wondering what the difference is between a private and a public IP address, the answer is very simple. A private IP address is one that is connected to a local network and interacts with other devices on the same network. Whereas a public IP is an address that can be only identified on the Internet.

Get Private or Local IP

Example 1. One of the main tools that we can use to display our local IP is the ip command. This command also allows us to configure our network parameters.

$ ip addr show

Output displaying private ip information using ip command

Example 2. The command can also be shortened to:

$ ip a

Example 3. You can also retrieve IP information with the hostname command, to check your system’s IP address.

$ hostname -I

Output displaying private ip information using hostname command

Example 4. Another alternative is the ifconfig command, which gives you the information of your current network.

$ ifconfig

Output displaying private ip information using ifconfig command

Get Public or External IP

In order to get the public IP of our network, we can use the wget and curl commands, followed by a web server that we can use to send an HTTP request and allow us to get our public IP information. In these examples, we will use ifconfig.me.

Example 1. Using the curl command:

$ curl ifconfig.me

Example 2. Using the wget command:

$ wget -qO- ifconfig.me

Output displaying public ip information using curl and wget

Displaying IP via GUI

If you want to get your IP information via GUI, follow these very simple steps.

Step 1. In the right top corner of your screen, right-click on the network icon, and then select Connection Information.

Accessing to the connection information menu through Kali desktop

Step 2. You will get a window with all the network information including IP, DNS, broadcast address, etc.

Window showing the system's network information

Leave a Comment

Your email address will not be published. Required fields are marked *