brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: route -n get default shows the gateway and interface your Mac uses

macOS
~/tips/tip-macos-route-get-default

route -n get default

Find out which router and which network interface carry your Mac's traffic.

With Wi-Fi, a dock with Ethernet and a VPN all active, it’s not obvious which one your Mac actually sends traffic through. The routing table knows.

Ask it for the default route:

route -n get default

Two lines matter in the output. gateway is the router your traffic goes to, and interface is the network device, such as en0. The -n keeps the output numeric, so it doesn’t stall on name lookups.

You can also ask about one specific address instead of the default. That tells you whether a VPN or a second network grabs traffic for that destination:

route -n get 203.0.113.10

If the interface is a utun device, the traffic goes into a VPN tunnel. If it’s the Ethernet port of your dock, the cable wins over Wi-Fi.

I find this the quickest check when a site loads on the phone but not on the Mac, or when I want to be sure a big download uses the cable. Which device name belongs to which port? networksetup -listallhardwareports maps them.

Only get is a read. The same route command can add, change and delete routes, and the man page notes that only the super-user may modify the table. Those changes are easy to get wrong and can cut you off, so I’d leave them to the network settings or the VPN app.

Further reading: route.8 man page

More macOS tips System Settings > Accessibility > Hover Text > When using the pointer A Smart Folder in Notes collects notes by tag, checklist or date Type # in a Mac note to tag it, then filter by tag in the sidebar tmutil isexcluded ~/Projects/app/node_modules Crop an image in Preview by dragging a frame and clicking Crop All macOS tips (99) All topics

Link