How to Find Your Local Router IP Address in the Terminal

You can use your local router’s internal IP address to test if a port is blocked by your local network, internet service provider (ISP), or virtual private network (VPN). Most operating systems (OSs) – Windows, macOS, Linux, BSD, etc. – with a graphical user interface (GUI) have pre-installed software that can give you this information. But if you’re working in the command line interface (CLI) on a related task, such as examining a traceroute/tracepath, knowing commands that can provide the same information improves your workflow.

Below we cover how to get your local router IP address in the terminal depending on your OS:

These commands may display multiple IP addresses if you’re connected to a VPN. Disconnect from the VPN and rerun the command to be sure which is your local router IP. On home networks, visit the IP address in your web browser (e.g. to ensure it displays the login page for your home router.

Get Your Local Router IP Address

Most OSs – netstat

The netstat command, pre-installed on most OSs, displays current TCP and UDP network connections with related processes. Netstat with the -r flag provides the IP routing table and internal router IP address.

netstat -r

The results will be the IP address in the first (Destination) column:

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface   U         0 0          0 eno2

You can use route for the same results:

route -e

Windows – ipconfig

The ipconfig command will show your local network connections and information.


Your local router’s internal IP will show to the right of Default Gateway under your current network (wireless, ethernet, etc.):

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

Linux – ip r

The ip command shows similar info to ifconfig and supersedes netstat (part of net-tools) on some Linux OSs. Replacing a with r filters the results to the IP (DNS names instead of host addresses) and interfaces while | grep filters the output to only rows including “default”.

ip r | grep default

The results will show the IP among related information:

default via dev eno2 proto metric 100 

You can use the following commands for the same results:

ip r list | grep default
ip route | grep default

Want to learn more about the command line interface? Check out these 5 free ways to learn Linux.

Develop your next great project with our secure Cloud Server Hosting.

InMotion Hosting Contributor
InMotion Hosting Contributor Content Writer

InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!

More Articles by InMotion Hosting

One thought on “How to Find Your Local Router IP Address in the Terminal

  1. I really appreciate you providing alternate methods. All worked for me, and I’m using a Linux partitioned portion of my Chromebook drive (just working with 10GB for now) which is only labeled Penguin (and I’ve read its Ubuntu, but that it for info). So other instructions I’ve found don’t always work because if the Linux version I’m semi-blindly using.

Was this article helpful? Join the conversation!

Shop the Black Friday Sale
Hurry! These Deals Won't Last Long