Static Route Commands Generator
Generate reviewed static-route commands across host and network CLIs with CIDR normalization plus priority checks and rollback-ready delete output.{{ summaryTitle }}
{{ summaryLine }}
{{ summaryAnnouncement }}
Route path visual unavailable.
{{ computation.values.command_text }}{{ commandExportStatus }}
{{ chartExportStatus }}
The chart renderer is unavailable. Priority values remain available in the route ledger.
| Row | Destination | Family | Next hop | Interface | Priority | Name | Generated command | Copy |
|---|---|---|---|---|---|---|---|---|
| {{ row.row }} | {{ row.destination }} | {{ row.family }} | {{ row.next_hop }} | {{ row.interface }} | {{ row.priority }} | {{ row.name }} | {{ row.command }} |
{{ ledgerExportStatus }}
| Check | Status | Evidence | Action | Copy |
|---|---|---|---|---|
| {{ row.check }} | {{ row.status }} | {{ row.evidence }} | {{ row.action }} |
{{ reviewExportStatus }}
A static route sends traffic for a destination prefix toward a chosen next hop or interface. It is useful when one network needs a deliberate path that dynamic routing will not supply, such as a lab subnet, partner connection, VPN network, management route, or temporary migration path.
- Destination
- The IPv4 or IPv6 network, host, or default prefix whose traffic the route covers.
- Next hop
- The neighboring router that should receive matching packets. Some platforms also accept an egress interface or a discard route type.
- Priority
- A platform-specific metric, distance, or preference used to compare candidate routes. Lower values are treated as preferred by this command model.
Route selection starts with the destination. A more specific prefix normally wins over a broader one, so a route for 10.20.30.0/24 is considered before 10.20.0.0/16 for an address inside both. A default route, 0.0.0.0/0 or ::/0, is the catch-all only when no more specific entry applies.
Repeated destinations can be intentional for equal-cost forwarding or a preferred and backup path, but the same rows can also create an accidental conflict. Address family matters too: an IPv4 destination cannot use an IPv6 gateway, and the word default is ambiguous without an address-family clue.
Adding or deleting a route can interrupt management access immediately. Generated syntax is only a change draft; it cannot see the installed routing table, virtual routing context, interface reachability, policy rules, persistence configuration, or the command behavior of a particular software release. Capture current state and prepare rollback before applying any route change.
How to Use This Tool:
Prepare one normalized route list, then use the platform and operation choices to produce both the change and its matching rollback.
- Enter Route rows as destination, next hop, interface, priority, name, and note. A header is optional; use
::/0when an IPv6 default route must be explicit. - Select the exact Platform and choose Add routes, Replace routes, or Delete routes. Syntax and validation change with that target.
- Set an optional Default priority only when blank route rows should emit one value. Use a Linux routing table or Junos routing instance only for its matching platform.
- Check the normalized destinations, priorities, repeated prefixes, and Paste safety review. Preserve the normalized rows and switch to delete mode to prepare rollback text before the change window.
Interpreting Results:
The command block is ready for review when every route row passes syntax and address-family checks. It is not proof that the next hop is reachable or that the command will preserve access to the device.
- Review every normalized prefix. A host without a prefix becomes
/32for IPv4 or/128for IPv6, while an IPv4 address with host bits is reduced to its network address. - Treat repeated destinations and explicit priorities as design decisions. Confirm whether they represent equal-cost paths, floating backup routes, or accidental duplicates.
- After applying a change, inspect the live route table and query a representative destination. A syntactically correct command can still select the wrong interface, table, virtual routing context, or gateway.
Technical Details:
Static-route syntax differs widely, but the governing decision is stable: validate a destination and forwarding target, normalize the route tuple, then render that tuple through one platform profile. The input accepts up to 250 route rows and a route source limited to 256 KiB.
Rule Core:
| Input condition | Rule | Result |
|---|---|---|
default | Use ::/0 only when the next hop is recognizably IPv6; otherwise use 0.0.0.0/0. | An address-family warning appears when IPv4 is assumed without a usable clue. |
| Host address without prefix | Append /32 for IPv4 or /128 for IPv6. | The ledger records an explicit host route. |
| IPv4 CIDR with host bits | Apply the prefix mask and replace the address with the network base. | The normalization is reported for review. |
| IPv6 CIDR | Validate the address and prefix from 0 through 128, then lowercase the address text. | No expanded network-base calculation is performed. |
| Add or replace row | Require a next hop or interface; Windows profiles require an IP next hop. | Incomplete forwarding targets block generation. |
| Priority | Accept a whole number from 0 through 4,294,967,295. A row value overrides the default input; a blank value uses the platform comparison default. | The priority comparison identifies the chosen source. |
Each profile maps the normalized tuple to the native command family. Replace is not universally atomic: some targets use a change or replace verb, while others remove the old entry and create a new one.
| Platform family | Generated command model | Important boundary |
|---|---|---|
| Linux iproute2 | ip route add, replace, or del; IPv6 uses ip -6. Optional table, interface, metric, and static protocol fields are emitted. | Runtime routes may need separate persistent network configuration. |
| Windows route.exe | route -p add, route change, or route delete. | This profile accepts IPv4 only; use PowerShell NetRoute for IPv6. |
| PowerShell NetRoute | New-NetRoute and Remove-NetRoute; replace removes then creates. | An IP next hop is required for add and replace. |
| macOS / BSD | route -n add, change, or delete with IPv4 or IPv6 selection. | Persistence is outside the generated runtime command. |
| Cisco IOS, NX-OS, and Arista EOS | ip route or ipv6 route; delete prefixes the command with no. | A route name is emitted only for non-delete IPv4 rows. |
| Junos | set or delete under global routing options or a routing instance. | Repeated destinations with a different priority may use qualified-next-hop. |
| FRR / SONiC and VyOS | FRR uses route statements with no for deletion; VyOS uses set and delete. | VyOS replace deletes the destination before setting it again. |
| MikroTik and FortiGate | RouterOS uses add, set, or remove expressions; FortiOS emits static-route configuration blocks. | FortiGate delete requires a numeric route ID in the name column. |
Blank priorities use comparison values of 0 for Linux and macOS/BSD; 1 for Cisco-like, FRR, VyOS, and MikroTik profiles; 5 for Junos; 10 for FortiGate; and 256 for Windows profiles. These values support the priority comparison only. A blank row does not emit an explicit priority unless the platform command needs another field.
Limitations:
No live device or host is queried. The generator cannot confirm installed routes, recursive next-hop resolution, virtual routing and forwarding context, policy-routing rules, interface state, feature licenses, or release-specific syntax.
- Verify add, replace, and delete behavior on the exact target before pasting a batch.
- Confirm route persistence separately for operating-system commands.
- Use the normal candidate, commit, save, or rollback process for managed network devices.
Worked Examples:
Normalize a Linux partner route
A destination entered as 172.20.9.7/16 with next hop 10.44.20.253 normalizes to 172.20.0.0/16. Add mode produces an ip route add command, and the review warns that the original host bits were removed.
Keep a rollback tied to the same rows
After reviewing an add block, leave the normalized source unchanged and select Delete routes. Compare each removal line with the installed route tuple; a broad destination-only delete can match more than the change intended on some targets.
References:
- ip-route(8) manual page, iproute2 project.
- Windows route command, Microsoft Learn.
- Static Route Preferences and Qualified Next Hops, Juniper Networks.
- How to add a static route with ip route, Simplified Guide.
- How to remove a static route in Linux, Simplified Guide.