configuration / network / static-routes

CLI REST-API

add-route

add-route [name] [table] [destination] [route] [options]
The "add-route" command adds a static route.

[name] is a free text (maxlength 128 chars, only letters, numbers and "-_.@" allowed)
  which is used to identify the route definition (and becomes the name of the submenu)
[table] is either "global" or a virtual interface ID like "vif0".
[destination] is an IPv4 or IPv6 address or network,
  i.e. 192.168.0.20 or 10.10.0.0/24 or fd00:49:bad:cafe::/64 etc. etc.
[route] is either an IPv4 or IPv6 address of the router (gateway),
  the name of a physical network device (e.g. "lan0") or the ID of a virtual interface (e.g. "vif0" or "vif9").
[options] is an optional free textfield
  (max. 255 chars, only letters, numbers, space allowed)
  which can hold additional routing options such as "metric 512".

Example:
add_route my_first_static_route global 10.0.0.0/16 192.168.0.10 metric 512
RESTAPI: The data can be passed in the body like this:
{
    "parameters": {
        "name": "my_first_static_route",
        "table": "global",
        "destination": "10.0.0.0/16",
        "route": "192.168.0.10",
        "options": "metric 512"
    }
}
NameValueDescriptionExample
namemy_first_static_route
tableglobal
destination10.0.0.0/16
route192.168.0.10
optionsmetric 512
See also:
/configuration/network/static-routes: static routes
/configuration/network/static-routes/delete-route: deletes a static route

REST-API Support:


This command is supported by the REST API:

Method: POST
URL: /api/configuration/network/static-routes/add-route
Body:
{
    "parameters": {
        "name": [name],
        "table": [table],
        "destination": [destination],
        "route": [route],
        "options": [options]
    }
}

Example using curl:
curl -X POST /api/configuration/network/static-routes/add-route -d 
"{
    \"parameters\": {
        \"name\": \"my_first_static_route\",
        \"table\": \"global\",
        \"destination\": \"10.0.0.0/16\",
        \"route\": \"192.168.0.10\",
        \"options\": \"metric 512\"
    }
}"