Learn how to update NAT Gateway port forwarding rules and enabled status.
Updating a port forwarding rule modifies its configuration to reflect changes in service ports, internal destination addresses, protocols, or enabled status. Adjust rules as your infrastructure evolves to maintain accurate traffic routing and security posture.
Follow this guide to update a NAT Gateway subscription port forwarding rule using the Vultr Customer Portal or API.
Navigate to Products, expand the Network drop-down and select VPC Networks.
Select your target VPC Network with NAT Gateway connectivity.
Scroll to the NAT Port Forwarding section.
Locate your target port forwarding rule in the list.
To enable or disable the rule, click the toggle switch next to the rule name.
Click the Edit icon (pencil icon) for the rule you want to modify.
The Edit Port Forwarding Rule panel opens with the current configuration:
Click Save Changes.
Send a GET request to the List VPCs endpoint to retrieve available VPCs.
$ curl "https://api.vultr.com/v2/vpcs" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
The output displays all VPCs in your account. Note the id field for the target VPC.
Send a GET request to the List NAT Gateway subscriptions endpoint to retrieve the gateway ID. Replace VPC_ID with the ID from the previous step.
$ curl "https://api.vultr.com/v2/vpcs/VPC_ID/nat-gateway" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
The output displays NAT Gateway subscriptions for the VPC. Note the id field for the target gateway.
Send a GET request to the List NAT Gateway Port Forwarding Rules endpoint to retrieve port forwarding rule IDs. Replace VPC_ID and NAT_GATEWAY_ID with your values.
$ curl "https://api.vultr.com/v2/vpcs/VPC_ID/nat-gateway/NAT_GATEWAY_ID/global/port-forwarding-rules" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
The output displays all port forwarding rules for the gateway. Each rule includes an id, name, external_port, internal_ip, and internal_port field. Note the id field for the rule you want to update.
Send a PUT request to the Update NAT Gateway Port Forwarding Rule endpoint. Replace VPC_ID, NAT_GATEWAY_ID, and PORT_FORWARDING_RULE_ID with your values. Specify the fields you want to update in the request body, including name, protocol (tcp, udp, or both), external_port, internal_ip, internal_port, enabled status, and description.
$ curl "https://api.vultr.com/v2/vpcs/VPC_ID/nat-gateway/NAT_GATEWAY_ID/global/port-forwarding-rules/PORT_FORWARDING_RULE_ID" \
-X PUT \
-H "Authorization: Bearer ${VULTR_API_KEY}" \
-H "Content-Type: application/json" \
--data '{
"name": "ssh-to-webserver-updated",
"protocol": "tcp",
"external_port": 2223,
"internal_ip": "10.0.0.10",
"internal_port": 22,
"enabled": true,
"description": "SSH access - port updated to 2223"
}'
Verify that the response contains the updated port forwarding rule configuration. The changes apply immediately and affect how traffic routes through the NAT Gateway to the internal destination.