Parallelstore runs within a Virtual Private Cloud (VPC) which provides
networking functionality to
[Compute Engine virtual machine (VM) instances](https://docs.cloud.google.com/compute/docs/instances),
[Google Kubernetes Engine (GKE) clusters](https://docs.cloud.google.com/kubernetes-engine/docs), and
[serverless workloads](https://docs.cloud.google.com/serverless#section-3).

The same VPC network must be specified when creating the Parallelstore instance
and client Compute Engine VMs or Google Kubernetes Engine clusters

You must also configure private services access within your VPC.

## Configure IAM permissions

You must have one of the following IAM permissions in order to set up network
peering for your project:

- [Compute Network Admin](https://docs.cloud.google.com/compute/docs/access/iam#compute.networkAdmin) (`roles/compute.networkAdmin`)
- [Service Networking Admin](https://docs.cloud.google.com/iam/docs/roles-permissions/servicenetworking#servicenetworking.networksAdmin) (`roles/servicenetworking.networksAdmin`)

To grant a role:

    gcloud projects add-iam-policy-binding PROJECT_ID \
      --member="user:EMAIL_ADDRESS"
      --role=ROLE

## Create and configure the VPC

1. Enable service networking.

       gcloud services enable servicenetworking.googleapis.com

2. Create a VPC Network.

       gcloud compute networks create NETWORK_NAME \
         --subnet-mode=auto \
         --mtu=8896

   > [!NOTE]
   > **Note:** Setting the value of `mtu` (*maximum transmission unit*, or the size of the largest IP packet that can be transmitted on this network) to the maximum allowed value of 8896 improves performance up to 10% compared to the default value of 1460 bytes.

3. Create an IP range.

   Private services access
   [requires a prefix-length of at least `/24`](https://docs.cloud.google.com/vpc/docs/configure-private-services-access#ip_address_range_size) (256 addresses).
   Parallelstore reserves 64 addresses per instance, which means that you can
   re-use this IP range with other services or other Parallelstore instances if
   needed.

       gcloud compute addresses create IP_RANGE_NAME \
         --global \
         --purpose=VPC_PEERING \
         --prefix-length=24 \
         --description="Parallelstore VPC Peering" \
         --network=NETWORK_NAME

4. Get the CIDR range associated with the range you created in the previous step.

       CIDR_RANGE=$(
         gcloud compute addresses describe IP_RANGE_NAME \
           --global  \
           --format="value[separator=/](address, prefixLength)"
       )

5. Create a firewall rule to allow TCP traffic from the IP range you created.

       gcloud compute firewall-rules create FIREWALL_NAME \
         --allow=tcp \
         --network=NETWORK_NAME \
         --source-ranges=$CIDR_RANGE

6. Connect the peering.

       gcloud services vpc-peerings connect \
         --network=NETWORK_NAME \
         --ranges=IP_RANGE_NAME \
         --service=servicenetworking.googleapis.com

## Known issues

Parallelstore instances and clients cannot use an IP address from the
172.17.0.0/16 subnet range. See [Known issues](https://docs.cloud.google.com/parallelstore/docs/known-issues)
for more information.

## What's next

- [Create a Parallelstore instance](https://docs.cloud.google.com/parallelstore/docs/create-instance)
- [Troubleshoot VPC networks](https://docs.cloud.google.com/parallelstore/docs/troubleshooting#troubleshooting-vpc-networks)