SOSysAdmin logo SOSysAdmin


How to add a network route to Windows

flag Scope

Adding a network route in a Windows machine.

construction How-to
First you will need to know the following mandatory parameters:
  • destination: The network destination of the route
  • netmask: The subnet mask of the destination of the route
  • gateway: the forwarding or next hop IP address

You can then proceed with the following:
  1. Open an elevated command prompt (Run as administrator)
  2. Execute the following command:
  3. route add destination mask netmask gateway

    So if, for example, you want to route traffic for the destination network 172.24.0.0/24 via the gateway 172.16.0.1 you should execute:
    route add 172.24.0.0 mask 255.255.255.0 172.16.0.1

    Note: by default the route is not permanent, meaning it will be lost on the next system reboot. To make it permanent, simply add /p at the end of the command, like this:
    route add 172.24.0.0 mask 255.255.255.0 172.16.0.1 /p


school Further considerations

  • You can read more about the route command on the official Microsoft documentation
  • Permanent routes are stored in the registry under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\PersistentRoutes




Article ID: SYS-WIN-0008