Find Your Default Gateway with route -n get default

Query the macOS routing table for the active default gateway, source address, and interface.

macOSgatewayrouteDiagnosticsLow risk
Run `route -n get default` and read the `gateway:` line; use `route -n get <ip>` to see the route a specific destination takes.

01Command

Command
$ route -n get default
# Gateway for a specific destination:
route -n get 8.8.8.8

02What it does

`route get` asks the kernel how it would route a packet and reports the gateway, interface (e.g. en0 or utun3), source IP, and even the destination MTU — much more precise than eyeballing `netstat -rn`. The `-n` flag skips reverse DNS lookups so the answer is instant. When a VPN or second network is active, this instantly reveals which interface wins for a given address.

03Risk

RiskLow risk
!Warning: Adding static routes (`route add ...`) requires sudo and is lost at reboot; persistent routes belong in a launchd script.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

Last verified: 2026-09-17 · Category: Network

06Related solutions