Add static routes to your Mac

For some reasons, I want to add self-defined static routes to my Mac. It's easy but requires root privilege.


Type this in your Terminal, for example:

sudo route -n add 192.168.2.0/24 172.31.30.5


This syntax add a static route to your Mac's route table:

Destination: 192.168.2.0
Genmask: 255.255.255.0
Next hop: 172.31.30.5


Hope this would help you guys.


Tom

MacBook Pro (15-inch, 2017), macOS High Sierra (10.13.6)

Posted on Sep 4, 2018 11:50 PM

Reply

There are no replies.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Add static routes to your Mac

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.