Skip to content

nat.php

Module for managing static NAT: adding and removing IP address forwarding rules via MikroTik.

API Methods

Method Action Description
add_static_nat add static NAT Adds a static NAT passthrough for the specified server. Accepts the server ID and ACL for IPMI.
remove_static_nat remove static NAT Removes the static NAT passthrough for the specified server or white IP.

nat/add_static_nat

Adds a static NAT passthrough for the specified server. Accepts the server ID and ACL for IPMI.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: add_static_nat
token string Authorization token
id int Server ID (inside params[] or at the top level)
ip_acl string ACL for IPMI in IP/CIDR format (e.g., 192.168.1.1/24)
ttl int Rule lifetime in hours (default 2, max 24)

Example Request

curl -s "https://api.hostkey.com/nat.php" -X POST \
--data "action=add_static_nat" \
--data "token=HOSTKEY_TOKEN" \
--data "id=VALUE" \
--data "ip_acl=VALUE"
Example of a successful response
{
"result": "OK",
"action": "add_static_nat",
"callback": "7bc29eb23fb1b879b21fce509597f07c"
}
Failure response
{
"code": -1,
"message": "NAT/add_static_nat: invalid server id"
}

nat/remove_static_nat

Removes the static NAT passthrough for the specified server or white IP.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: remove_static_nat
token string Authorization token
id int Server ID
white_ip string White IP to remove the rule for

Example Request

curl -s "https://api.hostkey.com/nat.php" -X POST \
--data "action=remove_static_nat" \
--data "token=HOSTKEY_TOKEN" \
--data "id=VALUE"
Example of a successful response
{
"result": "OK",
"action": "remove_static_nat",
"callback": "7bc29eb23fb1b879b21fce509597f07c"
}
Failure response
{
"code": -1,
"message": "NAT/remove_static_nat: invalid server id"
}

question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×