Add Static Route Windows How to Use Route Command Properly

To configure static routing in Windows, the route command offers precise control over network routes. Execute it via Command Prompt with administrative privileges for full functionality.

Understanding the Command Syntax

The basic syntax is: route add destination MASK subnet_mask gateway METRIC cost IF interface. Key parameters include:

  • destination: IP address or network subnet.
  • subnet_mask: Subnet mask for the destination.
  • gateway: IP address of the gateway router.
  • cost: Optional metric for route prioritization (lower values preferred).
  • interface: Optional interface index for routing.

Adding a Static Route

Run Command Prompt as Administrator:

Add Static Route Windows How to Use Route Command Properly
  • Press Win+X, select Command Prompt (Admin).
  • Use the command: route add destination MASK subnet_mask gateway.

Example: To route traffic for 192.168.1.0/24 via 192.168.0.1:

route add 192.168.1.0 MASK 255.255.255.0 192.168.0.1

For permanent addition (persists after reboot), append -p:

route add 192.168.1.0 MASK 255.255.255.0 192.168.0.1 -p

Verifying and Managing Routes

View the routing table with:

Add Static Route Windows How to Use Route Command Properly

route print

Delete a route using:

route delete destination

Example: route delete 192.168.1.0

Properly setting metrics and interfaces ensures efficient routing. Avoid typos to prevent network issues.

Add Static Route Windows How to Use Route Command Properly

Related News