> ## Documentation Index
> Fetch the complete documentation index at: https://docs.megaport.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Using Packet Filters with NAT Gateway

> This help topic describes how to create, edit, and apply packet filter lists on a NAT Gateway.

Packet filters control which traffic flows through your Megaport NAT Gateway (NAT Gateway). Packet filters allow data from defined IP addresses to pass through, and deny access to data from other defined IP addresses.

Packet filters are defined on a NAT Gateway after it has been ordered and has gone live. You then edit the configuration of your NAT Gateway to add the packet filters that you need. When you configure a connection to your NAT Gateway, you can add your packet filters to either the A-End or B-End of the connection, depending on your NAT Gateway's location.

![](https://docs.megaport.com/images/nat/dia-packet-filters-nat-gateway.png)

## Packet filter rules

* Packet filter lists are defined on a deployed NAT Gateway.
* Packet filter lists are applied to the VXC interface - either A-End or B-End, depending where your NAT Gateway is located.
* If no packet filters are applied to the connection, then all traffic is allowed to flow through your NAT Gateway.
* When a packet filter is applied to the connection, any traffic not permitted by the packet filter is denied.
* Packet filters support the following matches:
  * Source IP Address
  * Destination IP Address
  * IP Protocol
  * Source Port/Port Range (for TCP and UDP protocols)
  * Destination Port/Port Range (for TCP and UDP protocols)
* Packet filters support both IPv4 and IPv6.
* You can create up to 20 packet filter lists.
* Each packet filter list can contain up to 50 entries.

## Creating packet filters

You can only create packet filters on a deployed NAT Gateway. You can create a maximum of 20 packet filter lists per NAT Gateway.

**To create a packet filter list**

1. Create, order, and deploy a NAT Gateway.\
   For more information, see [Creating a NAT Gateway](https://docs.megaport.com/nat/creating-nat-gateway.md).

2. On the **Services** page, in the **Actions** section for the NAT Gateway, click **Details**.

3. Select the **Configuration** tab, then click **Packet Filter Lists**.

4. Click **New List**.

   ![Packet Filter Lists section of the NAT Gateway Configuration tab with the New List button highlighted](https://docs.megaport.com/images/nat/nat-packet-filter-new-list.png)

   A new, unsaved list appears.

5. Specify a name for the packet filter list.

6. Specify the filter details for the entry:

   * **Action** -- Select **Permit** or **Deny**.

   * **Source IP Address** -- Specify the source IP address you want to filter traffic from.

   * **Destination IP Address** -- Specify the destination IP address of your filter.

     > [!NOTE]
     >
     > The source IP address and destination IP address must be the same format. For example, they must both be IPv4 or IPv6.

   * **Protocol** -- Select **All Traffic**, **TCP (6)**, **UDP (17)**, or **ICMP (1)**. If the protocol you require is not on the list, select **Custom**.

   * **IP Protocol Number** -- This value is populated automatically when you select a protocol. If you select **Custom**, specify a number from the list of assigned internet protocol numbers.

   * **Source Ports** -- Specify a source port or a range of ports in the format 1111-9999. Ports are available for the TCP and UDP protocols.

   * **Destination Ports** -- Specify a destination port or a range of ports.

   * **Description** (optional) -- Specify a description for the entry.

   A new, blank entry row appears below the entry. Add as many entries to the list as you need, up to a maximum of 50 per list.

   To manage an entry, use the icons in the entry row:

   * Drag the reorder handle at the start of the row to move the entry up or down the list.
   * Click **Duplicate entry** to copy the entry.
   * Click **Delete entry** to remove the entry.

7. Click **Save**.

   ![Packet filter list with a sample entry and the Save button highlighted](https://docs.megaport.com/images/nat/nat-packet-filter-list-entry.png)

   To discard your changes instead, click **Revert**.

## Editing a packet filter list

Add or delete entries from a packet filter list, or update the settings of each entry.

**To edit a packet filter list**

1. On the **Configuration** tab of the NAT Gateway details page, click **Packet Filter Lists**.

2. Locate the list you want to edit. If the list is collapsed, click the arrow next to the list name to expand it.

3. Make your changes.\
   You can change any part of the list.

4. Click **Save**.

## Duplicating a packet filter list

You can duplicate a list to speed up filter configuration.

**To duplicate a packet filter list**

1. On the **Configuration** tab of the NAT Gateway details page, click **Packet Filter Lists**.

2. Next to the list you want to duplicate, click **Duplicate List**.

3. Specify a name for the new list.

4. Edit the required details in the list to make it unique.

5. Click **Save**.

## Deleting a packet filter list

You can delete entire lists if they are not required any more or are out of date.

**To delete a packet filter list**

1. On the **Configuration** tab of the NAT Gateway details page, click **Packet Filter Lists**.

2. Next to the list you want to delete, click **Delete List**.

3. In the Delete List screen, click **Delete**.

## Applying a packet filter list

After you create a packet filter list on the NAT Gateway, you can apply it to a VXC connected to the NAT Gateway.

**To apply a packet filter list**

1. On the **Services** page, select **Details** > **A-End** (or **B-End**) for the VXC.

2. Under Packet Filters, select a packet filter list from the **Inbound** or **Outbound** drop-down list, as required for your configuration.

   ![Packet Filters section of the VXC A-End page with the Inbound and Outbound drop-down lists](https://docs.megaport.com/images/nat/nat-vxc-packet-filters.png)

3. Click **Save**.

You can also apply packet filter lists when you create a connection from the NAT Gateway. For more information, see [Creating a NAT Gateway VXC](https://docs.megaport.com/nat/nat-gateway-vxc.md).

## Helpful references

* [Creating a NAT Gateway](https://docs.megaport.com/nat/creating-nat-gateway.md)
* [Creating a NAT Gateway VXC](https://docs.megaport.com/nat/nat-gateway-vxc.md)
* [Megaport NAT Gateway Route Filtering](https://docs.megaport.com/nat/route-filtering.md)
* [NAT Gateway Features](https://docs.megaport.com/nat/nat-gateway-features.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.