How to find out ip address of router
Solution 1
Update:
In Terminal.app type
route get default
or
route get default | grep gateway
for more condensed output.
This is the fastest way as pointed out by Daniel. Thanks Dan.
Original Anwser:
There is another way that will take a lot longer:
netstat -r | grep default
The convention is to give the router the first address on the subnet. This means, in most cases, your router's IP address is the same as your IP address except it ends in 1.
For example:
If your IP is 10.0.0.105, then your router's IP is probably 10.0.0.1.
If your IP is 192.168.1.83, then your router's IP is probably 192.168.1.1
Solution 2
I was at first a bit confused by the output from the route get default | grep gateway
commands on my Mac (OS X 10.9.4), as it yielded in my case a host name rather than an IP address.
gateway: homeportal
In case anyone else comes here wanting the IP address as well, adding the -n
option could possibly help (according to the documentation, it will bypass attempts to print host and network names symbolically when reporting actions):
route -n get default | grep gateway
which yielded:
gateway: 192.168.1.254
Related videos on Youtube
Kunihiko Karasawa
Updated on September 17, 2022Comments
-
Kunihiko Karasawa almost 2 years
How can I find out what IP my router on my local area network is using?
-
Tog over 13 yearsWhat Operating system?
-
Kunihiko Karasawa over 13 yearsmy os is mac os x
-
-
Trezoid over 13 yearsyou'll have to go into advanced, and click on the TCP/IP tab for the more specific information
-
Lior L over 13 yearsIt should be noted that the router also often is assigned the last IP address in the subnet. For example 192.168.1.254 or 10.0.0.254. For home router's default configurations Jay's addresses are far more likely though.
-
HikeMike over 13 yearsWhat's the difference between this and the faster
route get default
? -
Vikram Jhurry over 13 yearsAlso keep in mind that if the LAN you're on has internal DNS that the router's IP may not be shown, but its' hostname. Which you can just give to the
host
command to get the IP. -
Jay over 13 years@Daniel Beck, The difference is that netstat takes a lot longer :) I updated my answer. +1 for being awesome.
-
David P. almost 5 yearsThis is the best answer for macOS. You can also a pipe it through awk to strip the extra text.
route -n get default | grep gateway | awk '{print $2}'