A Virtual Private Cloud (VPC) network that uses the
Remote Direct Memory Access (RDMA) over Converged Ethernet (RoCE) network
profile is called an *RoCE VPC network*.
This page shows you how to create an RoCE VPC network and
configure firewall rules that apply to the network.
Before you begin, review the following information:

- [RDMA RoCE network profile](https://docs.cloud.google.com/vpc/docs/rdma-network-profiles.md.txt)
- [Cloud NGFW for RoCE VPC networks](https://docs.cloud.google.com/firewall/docs/firewall-for-roce.md.txt)

Because the rules in a regional network firewall policy used by an RoCE
VPC network rely heavily on target secure tags and source secure
tags, ensure that you're familiar with how to
[create and manage secure tags](https://docs.cloud.google.com/firewall/docs/use-tags-for-firewalls.md.txt) and
[bind secure tags](https://docs.cloud.google.com/firewall/docs/use-tags-for-firewalls.md.txt#bind-tags)
to the VM instances.

This section describes how to perform the following tasks:

- Create an RoCE VPC network
- Create a regional network firewall policy that works with the RoCE VPC network
- Create rules in the regional network firewall policy
- Associate the regional network firewall policy with the RoCE VPC network

## Before you begin

Make sure that you review the
[supported and unsupported features](https://docs.cloud.google.com/vpc/docs/rdma-network-profiles.md.txt#supported-features) in
VPC networks with an RDMA network profile. If you attempt to
configure unsupported features, Google Cloud returns an error.

## Create a network with an RDMA network profile

To create a VPC network with an RDMA network profile, do the
following.

### Console

1. In the Google Cloud console, go to the **VPC networks** page.


   [Go to VPC networks](https://console.cloud.google.com/networking/networks/list)

   <br />

2. Click **Create VPC network**.

3. In the **Name** field, enter a name for the network.

4. Keep the **Set MTU automatically** checkbox selected. When this checkbox
   is selected, Google Cloud automatically sets the MTU
   to the default value for the type of VPC network that you
   are creating. For VPC networks with an RDMA network profile,
   the default MTU value is `8896`.

5. Select **Configure network profile** and do the following:

   1. In the **Zone** field, select the zone of the network profile that you want to use. The VPC network that you create is constrained to this zone, which means that you can only create resources in the network in this zone.
   2. Select the RDMA network profile for the zone that you selected previously, such as `us-central1-b-vpc-falcon`, `us-central1-b-vpc-roce`, or `us-central1-b-vpc-roce-metal`.
   3. To view the set of supported features for the network profile that you selected, click **Preview network profile features**.
6. In the **New subnet** section, specify the following configuration
   parameters for a subnet:

   1. In the **Name** field, enter a name for the subnet.
   2. In the **Region** field, select the region in which to create the subnet. This region must correspond to the zone of the network profile that you configured. For example, if you configured a network profile in the `us-central1-b` zone (such as `us-central1-b-vpc-roce`), then you must create the subnet in the `us-central1` region.
   3. Enter an **IPv4 range** . This range is the [primary IPv4
      range](https://docs.cloud.google.com/vpc/docs/vpc#vpc_networks_and_subnets) for the subnet.

      If you select a range that is not an RFC 1918 address, confirm that
      the range doesn't conflict with an existing configuration. For more
      information, see [IPv4 subnet
      ranges](https://docs.cloud.google.com/vpc/docs/subnets#ipv4-ranges).
   4. Click **Done**.

7. To add more subnets, click **Add subnet** and repeat the previous steps.
   You can also [add more subnets](https://docs.cloud.google.com/vpc/docs/create-modify-vpc-networks.md.txt#add-subnets) to the network after you
   have created the network.

8. Click **Create**.

### gcloud

1. To create the network, use the [`gcloud compute networks create` command](https://docs.cloud.google.com/sdk/gcloud/reference/compute/networks/create.md.txt)
   and specify the `--network-profile` flag.

   ```
     gcloud compute networks create NETWORK \
         --subnet-mode=custom \
         --network-profile=NETWORK_PROFILE
   ```

   Replace the following:
   - `NETWORK`: a name for the VPC network
   - `NETWORK_PROFILE`: the zone-specific name of the
     network profile, such as `us-central1-b-vpc-falcon`,
     `us-central1-b-vpc-roce`, or `us-central1-b-vpc-roce-metal`.

     RDMA network profiles aren't available in all zones. To view the
     zone-specific instances of a network profile that are available,
     follow the instructions to
     [list network profiles](https://docs.cloud.google.com/vpc/docs/view-network-profiles.md.txt#list_network_profiles).
2. To add subnets, use the [`gcloud compute networks subnets create` command](https://docs.cloud.google.com/sdk/gcloud/reference/compute/networks/subnets/create).

   ```
     gcloud compute networks subnets create SUBNET \
         --network=NETWORK \
         --range=PRIMARY_RANGE \
         --region=REGION
   ```

   Replace the following:
   - `SUBNET`: a name for the new subnet
   - `NETWORK`: the name of the VPC network that contains the new subnet
   - `PRIMARY_RANGE`: the primary IPv4 range for the new subnet, in CIDR notation. For more information, see [IPv4 subnet ranges](https://docs.cloud.google.com/vpc/docs/subnets.md.txt#ipv4-ranges).
   - `REGION`: the Google Cloud region in which the new subnet is created. This must correspond to the zone of the network profile that you configured. For example, if you configured a network profile in the `us-central1-b` zone (such as `us-central1-b-vpc-roce`), then you must create the subnet in the `us-central1` region.

### API

1. To create the network, make a `POST` request to the
   [`networks.insert` method](https://docs.cloud.google.com/compute/docs/reference/rest/v1/networks/insert.md.txt)
   and specify the `networkProfile` property.

   ```
   POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/global/networks
   {
   "autoCreateSubnetworks": false,
   "name": "NETWORK",
   "networkProfile": "NETWORK_PROFILE"
   }
   ```

   Replace the following:
   - `PROJECT_ID`: the ID of the project where the VPC network is created
   - `NETWORK`: a name for the VPC network
   - `NETWORK_PROFILE`: the zone-specific name of the
     network profile, such as `us-central1-b-vpc-falcon`,
     `us-central1-b-vpc-roce`, or `us-central1-b-vpc-roce-metal`.

     RDMA network profiles aren't available in all zones. To view the
     zone-specific instances of a network profile that are available,
     follow the instructions to
     [list network profiles](https://docs.cloud.google.com/vpc/docs/view-network-profiles.md.txt#list_network_profiles).
2. To add subnets, make a `POST` request to the
   [`subnetworks.insert` method](https://docs.cloud.google.com/compute/docs/reference/rest/v1/subnetworks/insert.md.txt).

   ```
   POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/subnetworks
   {
   "ipCidrRange": "IP_RANGE",
   "network": "NETWORK_URL",
   "name": "SUBNET"
   }
   ```

   Replace the following:
   - `PROJECT_ID`: the ID of the project that contains the VPC network to modify
   - `REGION`: the name of the Google Cloud region where the subnet is added. This region must correspond to the zone of the network profile that you configured. For example, if you configured a network profile in the `us-central1-b` zone (such as `us-central1-b-vpc-roce`), then you must create the subnet in the `us-central1` region.
   - `IP_RANGE`: the primary IPv4 address range for the subnet. For more information, see [IPv4 subnet ranges](https://docs.cloud.google.com/vpc/docs/subnets.md.txt#ipv4-ranges).
   - `NETWORK_URL`: the URL of the VPC network where you're adding the subnet
   - `SUBNET`: a name for the subnet

## Create a regional network firewall policy

RoCE VPC networks only support regional network firewall
policies that have a policy type of `RDMA_ROCE_POLICY`.

### Console

1. In the Google Cloud console, go to the **Firewall policies** page.


   [Go to Firewall policies](https://console.cloud.google.com/net-security/firewall-manager/firewall-policies/list)

   <br />

2. In the project selector menu, select your project
   within your organization.

3. Click **Create firewall policy**.

4. In the **Configure policy** step, in the **Policy name** field, enter
   a policy name.

5. In the **Policy type** list, select **RDMA RoCE policy**.

6. In the **Region** list, select the region that contains the zone of
   the RoCE network profile used by the RoCE VPC network.

7. Click **Create**.

### gcloud

To create a regional network firewall policy for a RoCE VPC
network, use the
[`gcloud compute network-firewall-policies create` command](https://docs.cloud.google.com/sdk/gcloud/reference/compute/network-firewall-policies/create):

```
  gcloud compute network-firewall-policies create FIREWALL_POLICY \
      --region REGION \
      --policy-type=RDMA_ROCE_POLICY
```

Replace the following:

- `FIREWALL_POLICY`: a name for the network firewall policy
- `REGION`: a region you want to apply to the policy. The region must contain the zone of the RoCE network profile used by the RoCE VPC network.

## Create rules in the regional network firewall policy

Regional network firewall policies that have a policy type of `RDMA_ROCE_POLICY`
only support ingress rules, and have constraints on valid source,
action, and Layer 4 configuration flags. For more information,
see [Specifications](https://docs.cloud.google.com/firewall/docs/firewall-for-roce.md.txt#specifications).

### Console

To create an ingress rule that uses the source IP range `0.0.0.0/0`
and applies to all network interfaces in the RoCE VPC
network, do the following:

1. In the Google Cloud console, go to the **Firewall policies** page.


   [Go to Firewall policies](https://console.cloud.google.com/net-security/firewall-manager/firewall-policies/list)

   <br />

2. In the project selector list, select your project
   or the folder that contains your policy.

3. Click the name of your policy and then click **Create firewall rule**.

4. Enter the priority of the rule.

5. For **Target** , select **Apply to all**.

6. For **Source** , select **All IP addresses (0.0.0.0/0)**.

7. For **Action on match** , specify whether connections that match the
   rule are allowed (**Allow** ) or denied (**Deny**).

8. For **Logs** , select **Enabled** or **Disabled**.

9. Click **Create**.

To create an ingress rule that uses a source secure tag and applies to
specific network interfaces of VMs with an associated secure tag value,
do the following:

1. In the Google Cloud console, go to the **Firewall policies** page.


   [Go to Firewall policies](https://console.cloud.google.com/net-security/firewall-manager/firewall-policies/list)

   <br />

2. In the project selector list, select your project
   or the folder that contains your policy.

3. Click the name of your policy and then click **Create firewall rule**.

4. Enter the priority of the rule.

5. For **Target** , select **Apply to all**.

6. For **Source** , select **Secure tags** and do the following:

   1. Click **Select scope for tags**.
   2. On the **Select a resource** page, select the organization or project in which you want to create secure tags.
   3. Select the key-value pairs to which the rule is to apply.
   4. To add more key-value pairs, click **Add tag**.
7. For **Logs** , select **Enabled** or **Disabled**.

8. Click **Create**.

### gcloud

To create an ingress rule that uses the `--src-ip-ranges=0.0.0.0/0`
flag and applies to all network interfaces in the RoCE VPC
network, use the
[`gcloud compute network-firewall-policies rules create` command](https://docs.cloud.google.com/sdk/gcloud/reference/compute/network-firewall-policies/rules/create.md.txt):

```
  gcloud compute network-firewall-policies rules create PRIORITY \
      --direction=ingress \
      --layer4-configs=all \
      --enable-logging \
      --action ACTION \
      --firewall-policy FIREWALL_POLICY_NAME\
      --firewall-policy-region FIREWALL_POLICY_REGION \
      --src-ip-ranges=0.0.0.0/0
```

To create an ingress rule that uses a source secure tag and applies to
specific network interfaces of VMs with an associated secure tag value,
use the
[`gcloud compute network-firewall-policies rules create` command](https://docs.cloud.google.com/sdk/gcloud/reference/compute/network-firewall-policies/rules/create.md.txt):

```
  gcloud compute network-firewall-policies rules create PRIORITY \
      --direction=ingress \
      --layer4-configs=all \
      --enable-logging \
      --action ALLOW \
      --firewall-policy FIREWALL_POLICY_NAME\
      --firewall-policy-region FIREWALL_POLICY_REGION \
      --src-secure-tag SRC_SECURE_TAG[,SRC_SECURE_TAG,...] \
      --target-secure-tag TARGET_SECURE_TAG[,TARGET_SECURE_TAG,...]
```

Replace the following:

- `PRIORITY`: the [priority](https://docs.cloud.google.com/firewall/docs/firewall-policies-rule-details.md.txt#priority) of the rule
- `ACTION`: the [action on match](https://docs.cloud.google.com/firewall/docs/firewalls.md.txt#action_of_the_rule) of the rule
  - If you use `--src-ip-ranges=0.0.0.0/0`, you can use either `ALLOW` or `DENY`.
  - If you use `--src-secure-tag`, you can only use `ALLOW`.
- `FIREWALL_POLICY_NAME`: a name of the regional network firewall policy in which the rule is created.
- `FIREWALL_POLICY_REGION`: the region used by the regional network firewall policy in which the rule is created.
- `SRC_SECURE_TAG`: defines the [source parameter of the
  ingress rule](https://docs.cloud.google.com/firewall/docs/firewall-policies-rule-details#hfp-nfp-ingress-src) using a comma-separated list of secure tag values. For more information, see [Secure tags for firewalls](https://docs.cloud.google.com/firewall/docs/tags-firewalls-overview.md.txt).
- `TARGET_SECURE_TAG`: defines the [target parameter of the
  rule](https://docs.cloud.google.com/firewall/docs/firewall-policies-rule-details#targets) using a comma-separated list of secure tag values. For more information, see [Secure tags for firewalls](https://docs.cloud.google.com/firewall/docs/tags-firewalls-overview.md.txt).

## Associate the regional network firewall policy with an RoCE VPC network

Associate the regional network firewall policy with your RoCE
VPC network. This ensures that the policy's rules apply to the
`MRDMA` network interfaces within that network.

### Console

1. In the Google Cloud console, go to the **Firewall policies** page.


   [Go to Firewall policies](https://console.cloud.google.com/net-security/firewall-manager/firewall-policies/list)

   <br />

2. In the project selector menu, select your project that contains the
   policy with your RoCE VPC network.

3. Click your policy.

4. Click the **Associations** tab.

5. Click **Add Associations**.

6. Select the RDMA RoCE networks within the project.

7. Click **Associate**.

### gcloud

To associate a regional network firewall policy with an RoCE
VPC network, use the
[`gcloud compute network-firewall-policies associations create` command](https://docs.cloud.google.com/sdk/gcloud/reference/compute/network-firewall-policies/associations/create.md.txt):

```
  gcloud compute network-firewall-policies associations create \
      --firewall-policy FIREWALL_POLICY \
      --network NETWORK \
      --firewall-policy-region FIREWALL_POLICY_REGION
  
```

Replace the following:

- `FIREWALL_POLICY`: a name of the regional network firewall
  policy

  The regional network firewall policy must have a policy type of
  `RDMA_ROCE_POLICY`.
- `NETWORK`: a name of the RoCE VPC network

- `FIREWALL_POLICY_REGION`: the region of the firewall policy

  The region must contain the zone of the RoCE network profile used by the
  RoCE VPC network.

## What's next

- [Network profiles overview](https://docs.cloud.google.com/firewall/docs/network-profiles.md.txt)
- [Cloud NGFW for RoCE VPC networks](https://docs.cloud.google.com/firewall/docs/firewall-for-roce.md.txt)