Static Route Commands Generator
Generate static route add, replace, and delete commands for Linux, Windows, Cisco-like, Junos, and firewall CLIs with route-row checks.- {{ error }}
{{ result.commandText }}
| {{ header }} | Copy |
|---|---|
| {{ cell }} | |
| No rows for the current input. |
Introduction:
A static route is a deliberate forwarding entry in a host, router, or firewall routing table. It tells the device that traffic for a destination prefix should leave through a named gateway, interface, or special route target instead of being learned from a dynamic routing protocol.
Administrators use static routes for small, explicit decisions: a partner network reachable through a firewall, a lab subnet behind a test router, a temporary migration path, a backup default gateway, or a blackhole route for traffic that should be dropped. The same idea appears on Linux servers, Windows hosts, edge firewalls, campus switches, and router operating systems, but each platform names the pieces differently.
| Term | Practical meaning | Common mistake |
|---|---|---|
| Destination prefix | The network or host address being matched, such as 10.55.0.0/16 or ::/0. |
Using a host address when the intended change is for the whole subnet. |
| Next hop | The gateway that should receive matching traffic next. | Pointing at a gateway that is not reachable on the selected interface. |
| Metric, distance, or preference | A platform-specific value used when more than one route can match. | Assuming the same number has identical meaning on every platform. |
| Default route | The catch-all path used when no more specific route matches. | Changing broad outbound traffic without a tested rollback route. |
Static route command syntax is not portable. Linux uses ip route forms with optional tables and metrics. Windows can use route.exe or PowerShell NetRoute commands. Network devices use configuration syntax such as Cisco-style ip route, Junos static route statements, VyOS configuration paths, RouterOS route entries, or FortiGate router static tables.
Priority values deserve extra care because they are part syntax and part routing policy. Lower values are commonly preferred, but the label changes from metric to administrative distance to preference depending on the target. A repeated destination might be intentional equal-cost routing, a floating backup path, or an accidental duplicate.
A syntactically valid command block is still not a complete change plan. Static routes can redirect broad traffic, especially when the destination is a default route or a large prefix. The destination, next hop reachability, persistence method, and rollback text all need review before anyone pastes commands into a production device.
How to Use This Tool:
Start with the target platform and operation, then treat the generated output as review material rather than a paste-and-forget answer.
- Choose Platform. The target controls syntax, validation, priority wording, persistence notes, and which route families are allowed.
- Choose Operation: Add routes, Replace routes, or Delete routes. Use delete mode to prepare rollback output from the same reviewed rows.
- Paste one route per line in Route rows. The canonical columns are
destination,next-hop,interface,priority,name,note. A header row is optional, and a CSV, TXT, ROUTES, or CONF file under 256 KiB can be loaded into the textarea. - Use clear destination notation. CIDR prefixes,
default, IPv4 hosts, and IPv6 hosts are accepted. Use::/0when the intended default route is IPv6, because the worddefaultis treated as IPv4 unless an IPv6 next hop makes the family clear. - Open Advanced when the platform needs extra context. Default priority fills blank priority cells, Linux routing table targets a named or numbered Linux table, Junos routing instance targets non-global Junos routing options, Prepend sudo for Linux adjusts host shell output, and Network CLI config wrapper wraps supported device commands in configuration mode.
- Stop on Fix before pasting. Missing destinations, malformed CIDR, address-family mismatches, missing next-hop or interface values for add/replace output, unsupported names, FortiGate delete rows without numeric route IDs, and priority values outside
0through4294967295block command export. - Use Normalize after validation if you want a clean source for the ticket. The textarea is rewritten to canonical columns so add, replace, and delete outputs can be rebuilt consistently.
- Compare Route Commands, Route Ledger, Paste Safety Review, and Route Priority Map. Copy the commands only after the ledger and safety review match the intended routing change.
Interpreting Results:
Static routes ready means the current rows produced command text for the selected platform and operation. It does not confirm next-hop reachability, authorization, device state, or persistence after reboot. Blocked means at least one row must be corrected before the command output should be used.
Read the result as a change record. The command text is the paste candidate, the ledger is the row-by-row audit, the safety review lists operational concerns, and the priority map shows how explicit and default-derived priority values compare.
| Output area | Meaning | Follow-up check |
|---|---|---|
| Route Commands | The platform-specific add, replace, or delete block. | Paste only into the matching host shell or network CLI context. |
| Route Ledger | Normalized destination, address family, next hop, interface, priority label, name, and command per row. | Trust the normalized prefix shown here when it differs from the pasted source. |
| Paste Safety Review | Warnings for mixed address families, duplicate destinations, default routes, rollback readiness, and platform-specific persistence. | Resolve every Review row before the change window. |
| Route Priority Map | A chart of effective priority values, including platform defaults for blank cells. | Confirm lower values match the intended primary path for that platform. |
The main false-confidence risk is a clean command block aimed at the wrong scope. A host address normalized to a network boundary, a broad default route, or a repeated prefix can all be syntactically valid while still causing an outage if the routing intent is wrong.
Technical Details:
Route lookup normally starts with the most specific matching prefix. A /32 IPv4 host route beats a /24 network route, and both beat 0.0.0.0/0. IPv6 follows the same prefix-length idea across 128-bit addresses. When two candidates have the same destination specificity, platform policy, metric, distance, preference, interface metric, and equal-cost routing behavior decide which path is installed or used.
Prefix notation is the common handoff format, but platforms print and configure it differently. IPv4 Cisco-style commands split a destination into network address plus dotted netmask. Linux, PowerShell, Junos, FRR, VyOS, RouterOS, and many modern CLIs accept slash notation. Windows route.exe uses a destination address with a separate mask.
Rule Core:
| Route part | Accepted form | Technical effect |
|---|---|---|
| Destination | CIDR prefix, default, IPv4 host, or IPv6 host. |
Defines which packets can match the route; host routes become /32 or /128. |
| Next hop or interface | Gateway address, interface name, or a supported special route type for the selected platform. | Defines how matching traffic leaves the device. |
| Priority | Whole number from 0 through 4294967295. |
Maps to metric, route metric, administrative distance, preference, or distance where the platform command supports it. |
| Name and note | Safe labels and comments where the selected platform emits them. | Helps identify the change on platforms with route names, comments, or numeric route table IDs. |
Command families differ most in replace semantics, route persistence, and how they express route preference. A generated delete block should be checked against the target's exact configuration because some platforms remove by full route tuple while others rely on destination, find expressions, or table IDs.
| Platform family | Generated command shape | Priority wording |
|---|---|---|
| Linux and macOS / BSD | ip route add, ip route replace, ip route del, or route -n host commands. |
Linux emits metric when supplied; macOS / BSD output does not emit a priority field. |
| Windows | route -p add, route change, route delete, or PowerShell New-NetRoute, Set-NetRoute, and Remove-NetRoute. |
Windows route families use route metrics, and PowerShell route metrics interact with interface metrics. |
| Cisco-like CLIs | ip route, ipv6 route, and matching no forms, with optional config wrappers. |
The supplied value is emitted as administrative distance when present. |
| Junos | Static route statements under global routing options or the selected routing instance. | Preference controls static route choice; repeated destinations can use qualified next hops. |
| FRRouting, VyOS, RouterOS, FortiGate | Native static route, set, add, edit, remove, or delete syntax for each platform. | Values map to distance or route preference fields where the command form supports them; FortiGate output emits distance, not Fortinet route priority. |
Validation focuses on command shape before any operational approval. A next-hop IP address must match the destination family. Add and replace operations need a forwarding target. Platform-specific checks block known mismatches, including IPv6 rows for Windows route.exe, unsupported special next-hop words, Junos rows that mix a separate interface with a next-hop value, and FortiGate delete rows without a numeric route ID in the name column.
| Input | Accepted behavior | Boundary or warning |
|---|---|---|
| Destination | CIDR, default, IPv4 host, or IPv6 host. |
IPv4 host bits are normalized to the network boundary; host routes get /32 or /128. |
| Default route | default becomes IPv4 unless an IPv6 next hop makes the family clear. |
Use ::/0 for unambiguous IPv6 defaults. |
| Next hop and interface | Gateway address, interface name, or supported special route type depending on platform. | Add and replace rows need a forwarding target; family mismatches are blocked. |
| Priority | Whole numbers from 0 through 4294967295. |
Platform acceptance can be narrower than this general validation range, so large values still need target-side review. |
| Names and labels | Route names, Linux table names, and Junos routing-instance names accept letters, numbers, underscore, period, colon, and hyphen. | Unsupported characters are rejected to keep command text paste-safe. |
| Row volume | Up to 250 route rows. |
Larger changes should be split into reviewable paste blocks. |
Route Priority Map plots each route's effective priority. Explicit priorities use the row value. Blank priorities use platform defaults for charting, such as 1 for Cisco-like static routes, 5 for Junos, 256 for Windows route families, 10 for FortiGate, and 0 for Linux and macOS route output. The chart is a review aid, not a forwarding-table simulation.
Persistence differs by target. Linux and macOS route commands usually change runtime state unless another network manager or startup policy saves them. Windows route.exe add output includes persistent syntax. PowerShell NetRoute persistence depends on Windows policy store behavior and should be confirmed after applying. Network device commands still need the platform's normal commit, write, save, or configuration workflow where applicable.
Worked Examples:
Build Linux runtime routes for a partner network
A ticket lists 10.55.0.0/16 via 10.44.20.254 at priority 100 and 172.20.0.0/16 via 10.44.20.253 at priority 150. With Linux iproute2 and Add routes, Route Commands emits ip route add lines with proto static and metrics. Route Ledger should show two IPv4 rows, and Route Priority Map should place the lower metric on the intended primary path.
Prepare a Cisco rollback before the change window
A network operator normalizes the approved rows, changes Platform to Cisco IOS / IOS XE, and sets Operation to Delete routes. Route Commands emits no ip route or no ipv6 route lines, and Paste Safety Review marks rollback fit as ready. The add output and delete output can then travel together in the change record.
Fix a Windows IPv6 route family mismatch
A Windows route.exe target includes 2001:db8:100::/48 with an IPv6 next hop. The result is blocked because the Windows route.exe output path supports IPv4 only here. Switching Platform to Windows PowerShell NetRoute creates a command family that can represent IPv6 prefixes.
Review repeated Junos destinations
Two Junos rows use 192.0.2.0/24 with different next hops and priorities. Paste Safety Review flags the repeated destination, and the generated output can use qualified-next-hop behavior when priorities differ. The reviewer should confirm that the lower preference is the intended active path and that the higher preference is acceptable as backup behavior.
FAQ:
Why did a host address become a slash prefix?
A destination without a slash is treated as a host route. IPv4 hosts become /32, and IPv6 hosts become /128. IPv4 prefixes with host bits are normalized to the network boundary.
Why is default interpreted as IPv4?
The word default becomes 0.0.0.0/0 unless an IPv6 next hop makes the family clear. Use ::/0 when you mean an IPv6 default route.
Can I use the same rows for rollback?
Yes. Keep the normalized rows and switch Operation to Delete routes. Review the delete output because some platforms need identifiers, route names, or table IDs for clean removal.
Why does the route priority chart show values I did not enter?
Blank priority cells use platform defaults for charting so route ordering can still be reviewed. The ledger marks whether a priority was explicit or default-derived.
Do generated commands persist after reboot?
It depends on the target. Windows route.exe add output uses persistent syntax, while Linux and macOS route commands are runtime changes unless another system saves them. Network devices still need their normal commit, write, or save workflow.
Are my route rows sent to a server?
The route rows are parsed in your browser for command generation, ledger rows, safety review, chart data, and JSON output. No server-side route lookup is needed for the generated commands.
Does a valid command mean the next hop is reachable?
No. The generator checks syntax, family compatibility, and platform-specific command shape. It does not test target reachability, routing policy, interface state, or device acceptance.
Glossary:
- Destination prefix
- The network or host route being added, such as
10.55.0.0/16or::/0. - Next hop
- The gateway address or route type used to forward traffic toward the destination.
- Interface route
- A route that points traffic out a named interface instead of through a gateway address.
- Default route
- The catch-all route for destinations that do not match a more specific prefix.
- Metric
- A Linux or Windows route value used when comparing route candidates in that platform's routing table.
- Administrative distance
- A Cisco-style trust value where lower values are preferred among route sources.
- Preference
- A Junos route-selection value where lower values are preferred for static route selection.
References:
- How to add a static route with ip route, Simplified Guide.
- How to remove a static route in Linux, Simplified Guide.
- Configuring Static Routes with ip commands, Red Hat Documentation.
- route command, Microsoft Learn.
- New-NetRoute, Microsoft Learn.
- Describe Administrative Distance, Cisco.
- Static Route Preferences and Qualified Next Hops, Juniper Networks.
- STATIC, FRRouting documentation.
- Static routing, VyOS documentation.
- Routing concepts, Fortinet Document Library.