Logo

Armand.nz

Home / About / Linkedin / Github

Adding a Static Route on macOS

#macos #static route |

Adding a static route to the computer’s internal routing table may be essential to access resources directly or troubleshoot a system. In my own experience, I have come across this hurdle due to an overreaching VPN configuration that stops me from reaching private servers on my network.

This method of adding a static route will NOT persist through a reboot.

Executed from Terminal

Where A.B.C.D is the destination Network subnet and E is the subnet mask. F.G.H.J is the IP address of the next hop switch or router

sudo route -n add -net A.B.C.D/E F.G.H.J

For example, I need to reachmy private network 192.168.0.0/16 on my homelab router 10.0.0.20 :

sudo route -n add -net 192.168.0.0/16 10.0.0.20

comments powered byDisqus

Copyright © Armand