Management Plane API > Networking > Logical Routing And Services > NAT

Add a NAT rule in a specific logical router

Add a NAT rule in a specific logical router.

Request:

Method:
POST
URI Path(s):
/api/v1/logical-routers/<logical-router-id>/nat/rules
Request Headers:
n/a
Query Parameters:
n/a
Request Body:
NatRule+

Example Request:

POST https://<nsx-mgr>/api/v1/logical-routers/1977d30c-eee2-11e4-874d-0050569c7004/nat/rules { "action": "SNAT", "match_source_network": "192.168.1.1", "translated_network": "10.117.5.19", "match_service": { "resource_type": "L4PortSetNSService", "source_ports": ["9000"], "destination_ports": ["9000"], "l4_protocol": "TCP" }, "enabled": false }

Successful Response:

Response Code:
201 Created
Response Headers:
Location
Content-type: application/json
Response Body:
NatRule+

Example Response:

{ "resource_type": "NatRule", "id": "1029", "display_name": "01003000-0000-0405-0000-000000000018", "match_source_network": "192.168.1.1", "action": "SNAT", "logging": false, "match_service": { "resource_type": "L4PortSetNSService", "destination_ports": [ "9000" ], "l4_protocol": "TCP", "source_ports": [ "9000" ] }, "rule_priority": 1024, "translated_network": "10.117.5.19", "enabled": false, "nat_pass": true, "_last_modified_time": 1458852877750, "_create_time": 1458852877750, "_last_modified_user": "admin", "_system_owned": false, "_create_user": "admin", "_revision": 0 }

Required Permissions:

crud

Feature:

routing_nat

Additional Errors: