Skip to main content

modem_port_mappings

Creates, updates, deletes, gets or lists a modem_port_mappings resource.

Overview​

Namemodem_port_mappings
TypeResource
Idovh.xdsl.modem_port_mappings

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
idintegerID of the port mapping entry
namestringName of the port mapping entry
task_idintegerID of the ongoing todo (NULL if none) (wire: taskId)
allowed_remote_ipstring (ipv4)An ip which will access to the defined rule. Default : no restriction applied (example: 192.0.2.0) (wire: allowedRemoteIp)
descriptionstringDescription of the Port Mapping
external_port_endintegerThe last port of the interval on the External Client that will get the connections (wire: externalPortEnd)
external_port_startintegerExternal Port that the modem will listen on. List of externalPorts not available for now in the API : 8, 21, 68, 5060, 21800-21805, 51005 (wire: externalPortStart)
internal_clientstring (ipv4)IP address (e.g., 192.0.2.0) (example: 192.0.2.0) (wire: internalClient)
internal_portintegerThe port on the Internal Client that will get the connections (wire: internalPort)
internal_port_endintegerThe last port of the interval on the Internal Client that will get the connections (wire: internalPortEnd)
protocolstringType of protocol for the Port Mapping (TCP, UDP)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectname, service_nameReturns a port mapping rule: its protocol, external and internal ports, internal client, allowed remote IP and description.
listselectservice_namex_pagination_modeReturns the names of the port mapping rules of the modem of the access.
createinsertservice_name, external_port_start, internal_client, internal_port, name, protocolAdds a rule that forwards an external port range to a port of an internal client, optionally restricted to one remote IP. Returns the created rule.
updateupdatename, service_nameChanges the protocol, ports, internal client, allowed remote IP or description of a port mapping rule.
deletedeletename, service_nameRemoves the port mapping rule from the modem. Returns the task that performs the change.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
api_hoststringThe OVHcloud API host. Selected by OVH_ENDPOINT (ovh-eu, ovh-ca or ovh-us; default ovh-eu). (default: api.eu.ovhcloud.com, x-stackQL-envVarSelector: {"envVar":"OVH_ENDPOINT","default":"ovh-eu","values":{"ovh-eu":"api.eu.ovhcloud.com","ovh-ca":"api.ca.ovhcloud.com","ovh-us":"api.us.ovhcloud.com"}})
namestringName
service_namestringService name (wire: serviceName)
x_pagination_modestringSent as CachedObjectList-Pages by default so the list returns the full objects rather than their identifiers. (wire: X-Pagination-Mode)

SELECT examples​

Returns a port mapping rule: its protocol, external and internal ports, internal client, allowed remote IP and description.

SELECT
id,
name,
task_id,
allowed_remote_ip,
description,
external_port_end,
external_port_start,
internal_client,
internal_port,
internal_port_end,
protocol
FROM ovh.xdsl.modem_port_mappings
WHERE name = '{{ name }}' -- required
AND service_name = '{{ service_name }}' -- required
;

INSERT examples​

Adds a rule that forwards an external port range to a port of an internal client, optionally restricted to one remote IP. Returns the created rule.

INSERT INTO ovh.xdsl.modem_port_mappings (
allowed_remote_ip,
description,
external_port_end,
external_port_start,
internal_client,
internal_port,
internal_port_end,
name,
protocol,
service_name
)
SELECT
'{{ allowed_remote_ip }}',
'{{ description }}',
{{ external_port_end }},
{{ external_port_start }} /* required */,
'{{ internal_client }}' /* required */,
{{ internal_port }} /* required */,
{{ internal_port_end }},
'{{ name }}' /* required */,
'{{ protocol }}' /* required */,
'{{ service_name }}'
RETURNING
id,
name,
task_id,
allowed_remote_ip,
description,
external_port_end,
external_port_start,
internal_client,
internal_port,
internal_port_end,
protocol
;

UPDATE examples​

Changes the protocol, ports, internal client, allowed remote IP or description of a port mapping rule.

UPDATE ovh.xdsl.modem_port_mappings
SET
allowed_remote_ip = '{{ allowed_remote_ip }}',
description = '{{ description }}',
external_port_end = {{ external_port_end }},
external_port_start = {{ external_port_start }},
internal_client = '{{ internal_client }}',
internal_port = {{ internal_port }},
internal_port_end = {{ internal_port_end }},
protocol = '{{ protocol }}'
WHERE
name = '{{ name }}' --required
AND service_name = '{{ service_name }}' --required;

DELETE examples​

Removes the port mapping rule from the modem. Returns the task that performs the change.

DELETE FROM ovh.xdsl.modem_port_mappings
WHERE name = '{{ name }}' --required
AND service_name = '{{ service_name }}' --required
;