Quickly Get a Router IP Address from the Command Line
To quickly retrieve the IP address of the router you are connected through, type the following at the command line:
netstat -rn |grep default
The result will look something like this, showing the router IP directly after “default”:
default 192.168.1.1 UGSc 108 0 en0
netstat will work for both wired and wireless connections, the difference of which will be shown as the interface. These are typically en0 and en1, though the port interfaces will vary slightly with Macs that don’t include ethernet ports or AirPort wireless card, and for Macs with only one form of network connectivity it will almost always be en0.
For users who don’t want to bother with the command line, the router IP can also be found from the Network system preference panel.
Thanks to Hans and Jen for the tip