How to find a WiFi router's IP address using the command line

Users often encounter situations where standard access to the router's web interface via familiar addresses like 192.168.0.1 or 192.168.1.1 fails. This could be because the network administrator has changed the default local subnet settings, or the device has been reconfigured by a provider that uses non-standard address ranges for its subscribers. In such cases, knowing how to quickly access the network's technical parameters becomes a critical skill for any system administrator or advanced user.

Using the operating system's graphical interface is certainly convenient, but it doesn't always provide complete information or may malfunction if network drivers fail. The command line interface (CLI) is a powerful and reliable tool that allows you to interact directly with the network stack, bypassing unnecessary interface add-ons. Console commands provide the most accurate information about the current connection status and the gateway address through which your computer connects to the global network.

In this guide, we'll detail methods for obtaining a gateway IP address on various platforms, explain the technical process, and examine potential errors. Understanding the principles of DHCP and routing will help you do more than just copy and paste commands, but also manage your home or office network intelligently. We'll touch on the nuances of working with IPv4 and IPv6, and discuss what to do if standard diagnostics fail.

Basic principles of addressing in a local area network

Before we move on to practical commands, it's important to clearly understand what exactly we're looking for. In the context of a home network, Router IP address most often performs the function Default Gateway (default gateway). This is the entry and exit point for all traffic generated by your computer outside the local network. Without the correct gateway address, the device will be unable to communicate with servers on the internet, remaining isolated within the local network.

DHCP (Dynamic Host Configuration Protocol) automatically assigns your computer an IP address, subnet mask, and gateway address. When you connect to WiFi, the router acts as a DHCP server. It assigns your device a temporary address from its pool, but it always occupies a fixed address, which is usually the first or last address in the range. This is the address we need to calculate.

⚠️ Attention: In corporate networks with complex infrastructures, the gateway address may not match the router's web management interface address. In such cases, attempting to enter the gateway IP address into a browser may result in a proxy server authorization page or no response at all.

It's also important to distinguish between a device's physical address (MAC address) and logical address (IP). While the former is hardcoded into the network card and used to deliver frames within a single network segment, the latter is required for routing packets between different networks. The command line allows you to view both addressing types, providing a complete picture of the connection.

Finding the Gateway IP Address in Windows

The Windows operating system provides the simplest and most popular tool for network diagnostics - the utility ipconfigIt's built into all OS versions, from the ancient Windows 95 to modern server editions. You don't need administrator rights to run it, although some reset operations may require them. Open a command prompt by typing cmd in the Start menu or through the Run dialog (Win+R).

After starting the console, enter the command ipconfig and press Enter. The system will display a list of all network adapters. You need to find the section corresponding to your active connection—usually it's called "Wireless" or "Ethernet." In this section, look for the line Main gateway (or Default Gateway). The IP address listed there is your router's address.

C:\Users\User> ipconfig

Wireless LAN Adapter Wireless Network:

IPv4 IP address. . . . . . . . . . . : 192.168.1.45

Subnet mask. . . . . . . . . . .: 255.255.255.0

Default gateway . . . . . . . . . . .: 192.168.1.1

If the standard output seems too cluttered with unnecessary information, you can use the key /all to get detailed statistics or filter the output. However, for a quick check, the basic command is sufficient. If the gateway field displays 0.0.0.0 or is empty, this means the DHCP server has not issued any settings, and the connection has not been established.

☑️ Checking Windows network settings

Completed: 0 / 4

There is also a more modern PowerShell that offers cmdlets Get-NetIPConfigurationIt provides information in a more structured form, which is convenient for scripts, but for a one-time check, the classic ipconfig remains the fastest solution. Windows 10 and 11 users can also view this data through the GUI in Network Settings, but the CLI is faster and more reliable in the event of GUI crashes.

Finding a Router Address on macOS and Linux

In Unix-like systems, which include macOS and Linux distributions, the approach to network diagnostics is slightly different. Historically, the command used here was ifconfig, but in modern versions it is often marked as deprecated and replaced by a more powerful utility. ip from the iproute2 package. However, to obtain the gateway address in macOS, the most convenient command is still netstat or Apple-specific ipconfig getpacket.

For macOS users, the fastest way to find out the router's IP is the command netstat -nr | grep defaultIt displays the routing table and filters the default row. An alternative, more readable option for macOS: route get default | grep gatewayIn Linux distributions (Ubuntu, Debian, CentOS) the command works best ip route | grep default or simply ip r.

  • 🍏 macOS: Open Terminal and type netstat -nr | grep default — the gateway address will be in the second column.
  • 🐧 Linux: Use the command ip route | grep default, where the IP address you are looking for is located after the word via.
  • 💻 Cross-platform: Team ping with the TTL flag it can indirectly point to the gateway, but it is less reliable.

It's important to note that in Linux, some network commands may require superuser privileges (sudo), although viewing the routing table is generally accessible to everyone. If you use a graphical shell in Linux (GNOME, KDE), this information is also available in the network settings, but the terminal provides instant access without having to navigate through menus.

Why do interface names change in Linux?

In modern Linux distributions, network interface names may look strange, such as enp3s0 or wlp2s0. This is a result of the implementation of Predictable Network Interface Names (PNI), which tie the device name to its physical location on the bus rather than to the driver load order. This eliminates confusion when adding new network cards.

Using the Tracert command to analyze a path

Another elegant way to find out the router's IP address is to use the traceroute utility. In Windows, it's called tracert, and in Linux and macOS - tracerouteThe logic is simple: the first "hop" in the packet chain from your computer to any remote server is always your local gateway, that is, your router.

Launch the command prompt and run a traceroute to any trusted external resource, such as Google's DNS server. You don't need to wait for the full traceroute to complete; the first line of output is sufficient.

C:\Users\User> tracert -d 8.8.8.8

Tracing the route to 8.8.8.8 with a maximum of 30 hops:

1 <1 ms <1 ms <1 ms 192.168.1.1

2 15 ms 14 ms 16 ms 10.20.30.40

As you can see from the example, the address 192.168.1.1 is first on the list. This is your router. The key -d In the Windows command, this disables reverse IP address name resolution, which significantly speeds up the first result since the system doesn't need to query DNS servers. In Linux, the equivalent command would look like this: traceroute -n 8.8.8.8.

This method is especially useful if the team ipconfig For some reason, the gateway isn't showing (for example, if the static network configuration is buggy), but the internet is working. Tracing will show the actual packet path, confirming that routing is working.

Table of standard addresses of popular routers

Although the command line shows the exact address currently assigned, routers often use factory default settings. Knowing these addresses can be useful if you reset the device and lose network access. Below is a table of the most common addresses.

Manufacturer Standard IP address Alternative address Domain name
TP-Link 192.168.0.1 192.168.1.1 tplinkwifi.net
ASUS 192.168.1.1 192.168.50.1 router.asus.com
D-Link 192.168.0.1 10.0.0.1 dlink.local
Keenetic 192.168.1.1 192.168.0.1 my.keenetic.net
Tenda 192.168.0.1 192.168.2.1 tendawifi.com

Using domain names (eg my.keenetic.net) has become a popular trend because it's independent of a specific subnet. However, for this mechanism to work, the router's DNS server must be functioning properly. If you've changed your Windows DNS settings to a third-party one (e.g., 1.1.1.1), entering the domain name in the browser may not work, and you'll have to use the digital IP address.

📊 What is your router's default gateway address?
192.168.0.1
192.168.1.1
10.0.0.1
Another

Diagnosing interface access issues

Sometimes you find your IP address through the command line and enter it into your browser, but the setup page doesn't load. This could be caused by several factors. First, check if your router is using a non-standard port for the web interface. Instead of the standard 80, the administrator may have assigned, for example, 8080. In this case, you need to enter [port] in the address bar. 192.168.1.1:8080.

Secondly, the problem may lie in the browser cache or a protocol conflict. Some modern routers attempt to redirect the user from HTTP to HTTPS, but with self-signed security certificates, the browser may block access. Try opening incognito mode or a different browser. Also, make sure that a proxy server that intercepts local requests isn't enabled on your computer.

⚠️ Attention: If you are connected to the network through a VPN client, your traffic may go through a virtual adapter, and the command ipconfig This will show the VPN tunnel's gateway address, not the physical router's. To access the router's settings, temporarily disable the VPN.

Another common cause is a stuck ARP table. The computer may remember the old MAC address for the gateway IP address if the router was replaced but the IP remained the same. In this case, clearing the ARP cache with the command arp -d * (requires administrator rights) or simply restart the network adapter.

Frequently Asked Questions (FAQ)

What should I do if the ipconfig command shows the address 169.254.xx?

An address in the range 169.254.0.0 – 169.254.255.255 is called APIPA. This means your computer was unable to obtain an address from the DHCP server (router). Check the cable, reboot the router, or ensure that DHCP is enabled on the router. In this case, you can't find the router's IP address using this command because there's no connection to it.

Is it possible to change the router IP address via the command line?

You can't directly change the router's settings (change its IP) via the command line on your computer, as this requires logging into the web interface or using special management protocols (Telnet/SSH), if enabled. Standard Windows commands only display information but don't configure remote equipment.

Why does my router have two IP addresses (IPv4 and IPv6)?

Modern providers and equipment support dual protocol stacks. IPv4 (e.g., 192.168.1.1) is used for compatibility with older equipment, while IPv6 (a long address with letters) is used for modern traffic. An IPv4 address is usually sufficient for accessing settings, as web interfaces are often accessible via this address.

How do I find my router's IP address if I'm connected via WiFi but have no internet?

Lack of internet connection does not interfere with the operation of the local network. Commands ipconfig (Windows) or ip route (Linux) operate at the network adapter level. Even without access to the global network, you can see the gateway address if the physical connection to the router is established and the WiFi icon is lit.