You are using an unsupported browser. Please update your browser to the latest version on or before July 31, 2020.
close

Adding a Static Route to macOS

terminal


Overview

Whether setting up or troubleshooting a system, there are some situations where adding a static route to the computer's internal routing table is necessary:

  1. If there is not a static route already added to the network router. Perhaps because one is not needed for the day-to-day operation of the system (switching only) or the router does not support adding a static route.
  2. Changing the computer's default gateway to the switch IP would conflict with the ability to connect the computer to the internet for Remote Desktop Support.
  3. The installer has to connect to the internet using the WiFi connection, while hard wiring into the Just Add Power system in situations where the Just Add Power switch is not connected to the rest of the customer's network.

While adding a static route to a computer can be a great testing and troubleshooting tool, it will not enhance the actual operation of the system as the static route is only tied to the computer that the route is applied to. This method should not serve as a replacement for adding a Static Route to a system to access Layer 3 Features.


Command

The static route will NOT persist through a reboot.

Executed from Terminal

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

Variables:

  • A.B.C.D is the Just Add Power subnet
  • E is the Just Add Power subnet mask, converted to CIDR notation
    • 255.0.0.0 = 8
    • 255.255.0.0 = 16
    • 255.255.255.0 = 24
  • F.G.H.J is the IP address of the switch with Just Add Power devices attached

Examples

  1. For a J+P Network of 10.0.0.0, subnet mask 255.0.0.0 and switch IP 192.168.0.254
    sudo route -n add -net 10.0.0.0/8 192.168.0.254
  2. For a J+P Network of 172.27.0.0, subnet mask 255.255.0.0 and switch IP 192.168.1.49
    sudo route -n add -net 172.27.0.0/16 192.168.1.49
  3. For a J+P Network of 192.168.100.0, subnet mask 255.255.255.0 and switch IP 192.168.0.99
    sudo route -n add -net 192.168.100.0/24 192.168.0.99
  • 320
  • 13-Mar-2023
  • 238700 Views