action.skip

Managing IPFIX Targets with the API

This topic describes the API procedure to manage IPFIX flow export targets on Megaport Cloud Router (MCR) and Megaport NAT Gateway (NAT Gateway) services.

IPFIXIPFIX (IP Flow Information Export) is an IETF standard protocol (RFC 7011) that defines a universal method for exporting IP flow information from network devices such as routers, switches, and firewalls to a collector. It is the standardised successor to Cisco’s NetFlow v9, using a template-based model that allows exporters to define the structure of the data they send, making the format flexible and extensible. IPFIX is commonly used for network traffic monitoring, capacity planning, security analysis, and billing purposes.
(IP Flow Information Export) is a standard protocol for exporting network flow information to monitoring systems. You can configure IPFIX targets on your MCR or NAT Gateway to send flow records to external collectors for traffic analysis, capacity planning, and security monitoring.

Each MCR or NAT Gateway supports up to 3 IPFIX targets. Flow records are exported to the configured collector using either UDP or TCP transport.

Before you begin, obtain a valid access token. For more information, see Creating an API Key.

MCR IPFIX target endpoints

Creating an IPFIX target

To create an IPFIX target on an MCR, send a POST request with the target configuration.

Endpoint

POST {baseUrl}/v2/product/mcr2/{productUid}/flowExport

Path Parameters

Parameter Description
productUid The unique identifier (UUID) of the MCR.

Request Body

Field Required Description
description Yes A human-readable label for this IPFIX target. Must be unique per service.
localIpAddress No The source IP address on the MCR for the flow export stream. Must be an address configured on the service.
The localIpAddress and targetCollector IP address must be the same address family (IPv4 or IPv6).
protocol Yes The transport protocol: udp or tcp.
targetCollector Yes The IPv4 or IPv6 address of the flow collector.
The localIpAddress and targetCollector IP address must be the same address family (IPv4 or IPv6).
targetPort Yes The port of the flow collector. Valid range: 1-65535.

Example Request

{
    "description": "Primary Collector",
    "localIpAddress": "10.1.1.1",
    "protocol": "udp",
    "targetCollector": "192.168.0.1",
    "targetPort": 2055
}

Example Response

{
    "message": "IPFIX target created successfully",
    "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy",
    "data": {
        "id": 159,
        "description": "Primary Collector",
        "localIpAddress": "10.1.1.1",
        "protocol": "udp",
        "targetCollector": "192.168.0.1",
        "targetPort": 2055
    }
}

Getting an IPFIX target

Retrieve a specific IPFIX target by its ID.

Endpoint

GET {baseUrl}/v2/product/mcr2/{productUid}/flowExport/{flowExportId}

Path Parameters

Parameter Description
productUid The unique identifier (UUID) of the MCR.
flowExportId The unique identifier (integer) of the flow export target.

Example Request

GET {baseUrl}/v2/product/mcr2/7f5f9574-315e-4527-af44-122605a411de/flowExport/159

Example Response

{
    "message": "IPFIX target retrieved successfully",
    "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy",
    "data": {
        "id": 159,
        "description": "Primary Collector",
        "localIpAddress": "10.1.1.1",
        "protocol": "udp",
        "targetCollector": "192.168.0.1",
        "targetPort": 2055
    }
}

Updating an IPFIX target

Update an existing IPFIX target configuration.

Endpoint

PUT {baseUrl}/v2/product/mcr2/{productUid}/flowExport/{flowExportId}

Path Parameters

Parameter Description
productUid The unique identifier (UUID) of the MCR.
flowExportId The unique identifier (integer) of the flow export target to update.

Request Body

The request body uses the same fields as the create request.

Field Required Description
description Yes A human-readable label for this IPFIX target. Must be unique per service.
localIpAddress No The source IP address on the MCR for the flow export stream. Must be an address configured on the service.
The localIpAddress and targetCollector IP address must be the same address family (IPv4 or IPv6).
protocol Yes The transport protocol: udp or tcp.
targetCollector Yes The IPv4 or IPv6 address of the flow collector.
The localIpAddress and targetCollector IP address must be the same address family (IPv4 or IPv6).
targetPort Yes The port of the flow collector. Valid range: 1-65535.

Example Request

{
    "description": "Primary Collector - Updated",
    "localIpAddress": "10.1.1.2",
    "protocol": "tcp",
    "targetCollector": "192.168.0.2",
    "targetPort": 4739
}

Deleting an IPFIX target

Delete a specific IPFIX target from an MCR.

Note

A target cannot be deleted if it is still assigned to an interface.

Endpoint

DELETE {baseUrl}/v2/product/mcr2/{productUid}/flowExport/{flowExportId}

Path Parameters

Parameter Description
productUid The unique identifier (UUID) of the MCR.
flowExportId The unique identifier (integer) of the flow export target to delete.

Example Request

DELETE {baseUrl}/v2/product/mcr2/7f5f9574-315e-4527-af44-122605a411de/flowExport/159

Example Response

{
    "message": "IPFIX target '159' deleted successfully",
    "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy"
}

Listing IPFIX targets

Retrieve all IPFIX targets configured on an MCR.

Endpoint

GET {baseUrl}/v2/product/mcr2/{productUid}/flowExports

Path Parameters

Parameter Description
productUid The unique identifier (UUID) of the MCR.

Example Request

GET {baseUrl}/v2/product/mcr2/7f5f9574-315e-4527-af44-122605a411de/flowExports

Example Response

{
    "message": "IPFIX targets retrieved successfully",
    "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy",
    "data": [
        {
            "id": 159,
            "description": "Primary Collector"
        },
        {
            "id": 160,
            "description": "Secondary Collector"
        }
    ]
}

NAT Gateway IPFIX target endpoints

Creating an IPFIX target

To create an IPFIX target on a NAT Gateway, send a POST request with the target configuration.

Endpoint

POST {baseUrl}/v3/products/nat_gateways/{productUid}/flow_exports

Path Parameters

Parameter Description
productUid The unique identifier (UUID) of the NAT Gateway.

Request Body

Field Required Description
description Yes A human-readable label for this IPFIX target. Must be unique per service.
localIpAddress No The source IP address on the NAT Gateway for the flow export stream. Must be an address configured on the service.
The localIpAddress and targetCollector IP address must be the same address family (IPv4 or IPv6).
protocol Yes The transport protocol: udp or tcp.
targetCollector Yes The IPv4 or IPv6 address of the flow collector.
The localIpAddress and targetCollector IP address must be the same address family (IPv4 or IPv6).
targetPort Yes The port of the flow collector. Valid range: 1-65535.

Example Request

{
    "description": "Primary Collector",
    "localIpAddress": "10.1.1.1",
    "protocol": "udp",
    "targetCollector": "192.168.0.1",
    "targetPort": 2055
}

Example Response

{
    "message": "IPFIX target created successfully",
    "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy",
    "data": {
        "id": 159,
        "description": "Primary Collector",
        "localIpAddress": "10.1.1.1",
        "protocol": "udp",
        "targetCollector": "192.168.0.1",
        "targetPort": 2055
    }
}

Getting an IPFIX target

Retrieve a specific IPFIX target by its ID.

Endpoint

GET {baseUrl}/v3/products/nat_gateways/{productUid}/flow_exports/{flowExportId}

Path Parameters

Parameter Description
productUid The unique identifier (UUID) of the NAT Gateway.
flowExportId The unique identifier (integer) of the flow export target.

Example Request

GET {baseUrl}/v3/products/nat_gateways/7f5f9574-315e-4527-af44-122605a411ef/flow_exports/159

Example Response

{
    "message": "IPFIX target retrieved successfully",
    "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy",
    "data": {
        "id": 159,
        "description": "Primary Collector",
        "localIpAddress": "10.1.1.1",
        "protocol": "udp",
        "targetCollector": "192.168.0.1",
        "targetPort": 2055
    }
}

Updating an IPFIX target

Update an existing IPFIX target configuration.

Endpoint

PUT {baseUrl}/v3/products/nat_gateways/{productUid}/flow_exports/{flowExportId}

Path Parameters

Parameter Description
productUid The unique identifier (UUID) of the NAT Gateway.
flowExportId The unique identifier (integer) of the flow export target to update.

Request Body

The request body uses the same fields as the create request.

Field Required Description
description Yes A human-readable label for this IPFIX target. Must be unique per service.
localIpAddress No The source IP address on the NAT Gateway for the flow export stream. Must be an address configured on the service.
The localIpAddress and targetCollector IP address must be the same address family (IPv4 or IPv6).
protocol Yes The transport protocol: udp or tcp.
targetCollector Yes The IPv4 or IPv6 address of the flow collector.
The localIpAddress and targetCollector IP address must be the same address family (IPv4 or IPv6).
targetPort Yes The port of the flow collector. Valid range: 1-65535.

Example Request

{
    "description": "Primary Collector - Updated",
    "localIpAddress": "10.1.1.2",
    "protocol": "tcp",
    "targetCollector": "192.168.0.2",
    "targetPort": 4739
}

Deleting an IPFIX target

Delete a specific IPFIX target from a NAT Gateway.

Note

A target cannot be deleted if it is still assigned to an interface.

Endpoint

DELETE {baseUrl}/v3/products/nat_gateways/{productUid}/flow_exports/{flowExportId}

Path Parameters

Parameter Description
productUid The unique identifier (UUID) of the NAT Gateway.
flowExportId The unique identifier (integer) of the flow export target to delete.

Example Request

DELETE {baseUrl}/v3/products/nat_gateways/7f5f9574-315e-4527-af44-122605a411ef/flow_exports/159

Example Response

{
    "message": "IPFIX target '159' deleted successfully",
    "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy"
}

Listing IPFIX target summaries

Retrieve summaries of all IPFIX targets configured on a NAT Gateway.

Endpoint

GET {baseUrl}/v3/products/nat_gateways/{productUid}/flow_export_summaries

Path Parameters

Parameter Description
productUid The unique identifier (UUID) of the NAT Gateway.

Example Request

GET {baseUrl}/v3/products/nat_gateways/7f5f9574-315e-4527-af44-122605a411ef/flow_export_summaries

Example Response

{
    "message": "IPFIX target summaries retrieved successfully",
    "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy",
    "data": [
        {
            "id": 159,
            "description": "Primary Collector"
        },
        {
            "id": 160,
            "description": "Secondary Collector"
        }
    ]
}

Error responses

When a request fails, the API returns an error response with details about the issue.

HTTP Status Description
400 Bad request. The request body is invalid or missing required fields.
401 Unauthorized. The access token is missing or invalid.
403 Forbidden. You don’t have permission to access this resource.
404 Not found. The specified MCR, NAT Gateway, or IPFIX target doesn’t exist.
409 Conflict. The IPFIX target description is not unique, or the maximum number of targets (3) has been reached.

Helpful references