Verb | URI | Description |
PUT | /routers/router_id |
Create a new Neutron router |
Success and error response codes are not changed with regards to the operation as introduced by the L3 API extension.
Neutron API users can enable or disable SNAT on a router
specifying the enable_snat
attribute in
the external_gateway_info
attribute for
the router resource. This operation can be either used for
updating the SNAT status only, the external network, or
both attributes at the same time. In any case, if the
enable_snat
attribute is not
specified, it will default to True
. For
instance, if the current SNAT status is disabled, and the
router's gateway is updated to a different external
network without specifying enable_snat
,
SNAT will be enabled for the new network.
It is important to note that whenever updating a
router's external gateway information, the
network_id
parameter must be
specified always, even if the final goal is just to enable
or disable SNAT for the router on the same external
network.
The rest of this section provides some samples for updating a router's external gateway info with SNAT mode.
Example 4.39. Disable SNAT for the current external network
{ "router": { "name": "another_router", "admin_state_up": true, "external_gateway_info": { "network_id": "3c5bcddd-6af9-4e6b-9c3e-c153e521cab8"} } }
{ "router":{ "status":"ACTIVE", "external_gateway_info":{ "network_id":"3c5bcddd-6af9-4e6b-9c3e-c153e521cab8", "enable_snat":true }, "name":"another_router", "admin_state_up":true, "tenant_id":"6b96ff0cb17a4b859e1e575d221683d3", "id":"8604a0de-7f6b-409a-a47c-a1cc7bc77b2e" } }
{ "router":{ "status":"ACTIVE", "external_gateway_info":{ "network_id":"3c5bcddd-6af9-4e6b-9c3e-c153e521cab8", "enable_snat":false }, "name":"another_router", "admin_state_up":true, "tenant_id":"6b96ff0cb17a4b859e1e575d221683d3", "id":"8604a0de-7f6b-409a-a47c-a1cc7bc77b2e" } }
{ "router":{ "external_gateway_info":{ "network_id":"3c5bcddd-6af9-4e6b-9c3e-c153e521cab8", "enable_snat":false } } }
Example 4.40. Change external network and enable SNAT
{ "router": { "name": "another_router", "admin_state_up": true, "external_gateway_info": { "network_id": "3c5bcddd-6af9-4e6b-9c3e-c153e521cab8", "enable_snat": false} } }
{ "router": { "status": "ACTIVE", "external_gateway_info": { "network_id": "3c5bcddd-6af9-4e6b-9c3e-c153e521cab8", "enable_snat": false}, "name": "another_router", "admin_state_up": true, "tenant_id": "6b96ff0cb17a4b859e1e575d221683d3", "id": "8604a0de-7f6b-409a-a47c-a1cc7bc77b2e" } }
{ "router": { "external_gateway_info": { "network_id": "002ab3b9-9127-4158-be30-4b45f3814df5"} } }
{ "router": { "status": "ACTIVE", "external_gateway_info": { "network_id": "002ab3b9-9127-4158-be30-4b45f3814df5", "enable_snat": true}, "name": "another_router", "admin_state_up": true, "tenant_id": "6b96ff0cb17a4b859e1e575d221683d3", "id": "8604a0de-7f6b-409a-a47c-a1cc7bc77b2e" } }
Example 4.41. Change external network and keep SNAT disabled
{ "router": { "name": "another_router", "admin_state_up": true, "external_gateway_info": { "network_id": "3c5bcddd-6af9-4e6b-9c3e-c153e521cab8", "enable_snat": false} } }
{ "router": { "status": "ACTIVE", "external_gateway_info": { "network_id": "3c5bcddd-6af9-4e6b-9c3e-c153e521cab8", "enable_snat": false}, "name": "another_router", "admin_state_up": true, "tenant_id": "6b96ff0cb17a4b859e1e575d221683d3", "id": "8604a0de-7f6b-409a-a47c-a1cc7bc77b2e" } }
{ "router": { "external_gateway_info": { "network_id": "002ab3b9-9127-4158-be30-4b45f3814df5", "enable_snat": false} } }
{ "router": { "status": "ACTIVE", "external_gateway_info": { "network_id": "002ab3b9-9127-4158-be30-4b45f3814df5", "enable_snat": false}, "name": "another_router", "admin_state_up": true, "tenant_id": "6b96ff0cb17a4b859e1e575d221683d3", "id": "8604a0de-7f6b-409a-a47c-a1cc7bc77b2e" } }