Checking your IP address from the command line is one of the most efficient ways to troubleshoot network issues or verify your connection details. The Command Prompt on Windows and the Terminal on macOS and Linux provide immediate access to this information without the need for graphical interfaces. This process relies on built-in utilities that query the network stack for configuration data.
Understanding IP Addresses and Interfaces
Before diving into the commands, it is helpful to understand that your device can have multiple IP addresses. There is the local or private address used within your router's network, and there is the public address assigned by your Internet Service Provider. Furthermore, a single machine can have multiple network interfaces, such as Wi-Fi, Ethernet, or virtual adapters, each with its own configuration. The commands we will use allow you to view all of these details at once.
Primary Command for Windows: ipconfig
The standard tool for network diagnostics on Windows is ipconfig . This command displays all current TCP/IP network configuration values and refreshes Dynamic Host Configuration Protocol (DHCP) and Domain Name System (DNS) settings. It is the go-to command for quickly identifying your IPv4 address.
Executing the Command
To run this command, open the Start menu, type "cmd", and press Enter. In the window that appears, type the command and press Enter again. The output will list your connections under "Ethernet adapter" or "Wireless LAN adapter".
Executing ipconfig in Practice
Look for the section labeled "IPv4 Address". The number listed there, usually in the format 192.168.x.x or 10.x.x.x, is your local private IP address. If you see "Default Gateway", that is the IP address of your router. If you are connected via Wi-Fi, the process is identical to checking a wired connection; simply look for the "Wireless LAN adapter Wi-Fi" section.
Alternative Commands and Options
While ipconfig is sufficient for most users, there are additional switches that provide more specific data. For instance, appending /all to the command expands the output to include detailed information such as the MAC address, DHCP lease time, and DNS servers. This is particularly useful for advanced troubleshooting.
Checking your Address on macOS and Linux
Users of macOS and Linux utilize a different command-line utility called ifconfig , which stands for "interface configuration". However, many modern systems have deprecated this command in favor of the more powerful ip command from the iproute2 suite. The ip command is the standard for Linux distributions and is increasingly available on macOS.
Using the ip command
To check your IP address using the modern method, open your terminal and type ip addr or ip a . This command lists all network interfaces on your system. You are looking for a line labeled "inet" under an active interface like "enp0s3" or "wlan0". The number following "inet" is your IPv4 address.
Identifying Your Public IP Address
Regardless of the operating system, if you need to find your public IP address—the address seen by the rest of the internet—you cannot retrieve it using standard local commands like ipconfig or ip addr . This is because your router handles the translation between your local network and the internet. To view this external address, you must query an external server.