2 Methods to Get Default Gateway IP Address on Windows

2 Methods to Get Default Gateway IP Address on Windows

A default gateway is the network device responsible for sending traffic from a Windows computer to networks outside the local network. In typical home and office environments, this role is handled by a router, which provides access to other networks such as the internet. This tutorial provides 2 methods how to get the default gateway IP address on Windows.

Method 1 - CMD

The Windows Command Prompt can display network configuration details, including the default gateway assigned to each network adapter. The following command filters the ipconfig output to show the default gateway entry:

ipconfig | findstr /i "Default Gateway"

Example output:

Default Gateway . . . . . . . . . : 192.168.0.1

In this example, 192.168.0.1 is the IP address of the default gateway.

Method 2 - PowerShell

PowerShell provides access to the routing table through the Get-NetRoute cmdlet. The following command displays the IP address of the default gateway:

(Get-NetRoute -DestinationPrefix "0.0.0.0/0").NextHop

Example output:

192.168.0.1

Leave a Comment

Cancel reply

Your email address will not be published.