Ana içeriğe geç

nat.php

Static NAT management module: adding and removing IP address forwarding rules via MikroTik.

API Methods

Method Action Description
add_static_nat add static NAT Creates a static NAT passthrough via Microtic for the specified server with ACL and TTL support.
remove_static_nat remove static NAT Removes the static NAT passthrough for the specified server or white IP.

nat/add_static_nat

Creates a static NAT passthrough via Microtic for the specified server with ACL and TTL support.

HTTP Method: POST

Parameters:

Parameter Required Type Description
action string Method identifier: add_static_nat
token string Authorization token
id integer Server ID
ip_acl string IP ACL (IP/mask format)
secured integer Secure connection flag (0 or 1)
ttl integer TTL (max. 24)

Example Request

curl -s "https://invapi.hostkey.com/nat.php" -X POST \
--data "action=add_static_nat" \
--data "token=HOSTKEY_TOKEN" \
--data "id=12345"
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 for rule removal

Example Request

curl -s "https://invapi.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

```json { "code": -1, "message": "NAT/remove_static_nat: invalid server id" }