# How to Create, Delete, or Migrate a Machine to a Private Network Machines are Linux and Windows virtual machines with persistent storage, GPU options, and free unlimited bandwidth. They’re designed for high-performance computing (HPC) workloads. A private network is a dedicated network that’s logically isolated from other networks on Paperspace. Within this network, machines and [shared drives](https://docs.digitalocean.com/products/paperspace/machines/how-to/manage-shared-drives/index.html.md) communicate privately and securely with each other. Private networks are required for certain features, such as a [virtual private network (VPN)](https://docs.digitalocean.com/products/paperspace/machines/how-to/manage-vpn/index.html.md). Each private network you create is assigned a `/24` subnet belonging to the [RFC 1918 private IP address space](https://datatracker.ietf.org/doc/html/rfc1918). If you need to change your private network to a specific `/24` subnet, you should [submit a support ticket to Paperspace support](https://cloudsupport.digitalocean.com) with the specific `/24` subnet you want to use. The `24` subnet you want to use must adhere to the [RFC 1918 private IP address space](https://datatracker.ietf.org/doc/html/rfc1918). After you create and assign your machine to a private network, you cannot remove the machine from the private network. You can only [migrate your machine to a different private network](#assign-or-migrate-a-private-network-in-the-paperspace-console-migrate). When creating your private network, you need to choose the same [datacenter region](https://docs.digitalocean.com/products/paperspace/machines/details/availability/index.html.md) as the machines you want to add to the network. This is because private networks are region-specific and can only have machines that share the same region. ## Create a Private Network ### Using the Paperspace Console To create a private network, go to the [Paperspace console](https://console.paperspace.com), in the top-right corner, click the drop-down menu, select **CORE**, click the **Networks** tab, then click **CREATE NETWORK** to open the **Create Private Network** window. In the **Create Private Network** window, under the **Name** section, choose a name for your private network. Under the **Region** section, click the drop-down menu, then select the [region](https://docs.digitalocean.com/products/paperspace/machines/details/availability/index.html.md) you are creating your private network in. You should choose a region closest to you and your users as well as the same region as the machines you want added to the network. Afterwards, click **CREATE**. ### Using the Paperspace API When creating a private network using the Paperspace API, you need to provide the following values: - `name` (string): The name of your private network. - `region` (string): The [datacenter region](https://docs.digitalocean.com/products/paperspace/machines/details/availability/index.html.md) your private network belongs to. ## How to Create a Private Network Using the Paperspace API 1. [Create an API key to authenticate your requests to your Paperspace account](https://docs.digitalocean.com/reference/paperspace/api-keys/index.html.md) and save it for use. 2. Send a POST request to `https://api.paperspace.com/v1/private-networks`. Basic usage looks like this, but you can [read the usage docs for more details](https://docs.digitalocean.com/reference/paperspace/api-reference/index.html.md#operation/privateNetworks-create): ```bash curl -X POST \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $PAPERSPACE_API_KEY" \ -d '{ "name": "your-private-network-name", "region": "NY2" }' \ "https://api.paperspace.com/v1/private-networks" ``` ### Using the Paperspace CLI When creating a private network using the Paperspace CLI, you need to provide the following values: - `name` (string): The name of your private network. - `region` (string): The [datacenter region](https://docs.digitalocean.com/products/paperspace/machines/details/availability/index.html.md) your private network belongs to. ## How to Create a Private Network Using the Paperspace CLI 1. [Install `pspace`](https://docs.digitalocean.com/reference/paperspace/pspace/install/index.html.md), the Paperspace command-line tool. 2. [Create an API key to authenticate your requests to your Paperspace account](https://docs.digitalocean.com/reference/paperspace/api-keys/index.html.md) and save it for use with `pspace`. 3. Use the API key to grant `pspace` access to your Paperspace account. ```bash pspace login --api-key your-api-key ``` 4. Finally, run `pspace private-network create -F [flags]`. Basic usage looks like this, but you can [read the usage docs for more details](https://docs.digitalocean.com/reference/paperspace/pspace/commands/machine/index.html.md#pspace-private-network-create): ```bash pspace private-network create -F --name your-private-network-name --region NY2 ``` ## Delete a Private Network You cannot delete a private network if there are machines still attached to it, so first, [migrate all machines](#assign-or-migrate-a-private-network-in-the-paperspace-console-migrate) attached to the private network you want to delete to a different private network. You cannot migrate machines from an existing private network to a different private network using the Paperspace API or CLI. You need to either [migrate the machines using the Paperspace console](#assign-or-migrate-a-private-network-in-the-paperspace-console-migrate) or [deactivate all machines](https://docs.digitalocean.com/products/paperspace/machines/how-to/deactivate/index.html.md) attached to your private network. ### Using the Paperspace Console To delete a private network, go to the [Paperspace console](https://console.paperspace.com), in the top-right corner, click the drop-down menu, select **CORE**, then click the **Networks** tab. In the **Networks** page, find the private network you want to delete. In the top-right corner of that private network, click **…**, then click **Delete** to open the **Delete Network** window, prompting if you want to delete the private network you selected. If you want to delete the network, click **DELETE**. ### Using the Paperspace API When deleting a private network using the Paperspace API, you need to provide the following values: - `id` (string): The ID of the private network you want to delete. ## How to Delete a Private Network Using the Paperspace API 1. [Create an API key to authenticate your requests to your Paperspace account](https://docs.digitalocean.com/reference/paperspace/api-keys/index.html.md) and save it for use. 2. Send a DELETE request to `https://api.paperspace.com/v1/private-networks/{private-network-id}`. ```bash curl -X DELETE \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $PAPERSPACE_API_KEY" \ -d '{ "id": "nwhoe4ox" }' \ "https://api.paperspace.com/v1/private-networks/nwhoe4ox" ``` ### Using the Paperspace CLI When deleting a private network using the Paperspace CLI, you need to provide the following values: - `id` (string): The ID of the private network you want to delete. ## How to Delete a Private Network Using the Paperspace CLI 1. [Install `pspace`](https://docs.digitalocean.com/reference/paperspace/pspace/install/index.html.md), the Paperspace command-line tool. 2. [Create an API key to authenticate your requests to your Paperspace account](https://docs.digitalocean.com/reference/paperspace/api-keys/index.html.md) and save it for use with `pspace`. 3. Use the API key to grant `pspace` access to your Paperspace account. ```bash pspace login --api-key your-api-key ``` 4. Finally, run `pspace private-network delete `. ```bash pspace private-network delete nwhoe4ox ``` ## Assign or Migrate a Machine to a Private Network You cannot migrate machines from an existing private network to a different private network using the Paperspace API or CLI. You can only [migrate machines using the Paperspace console](https://docs.digitalocean.com/products/paperspace/machines/how-to/manage-private-networks/index.html.md#migrate). To assign or migrate a machine to a private network, go to your [Paperspace console](https://console.paperspace.com), in the top-right corner, click the drop-down menu, select **CORE**, then click the **Machines** tab. In the **Machines** section, find and select the machine you want to add a private network to. On the machine’s overview page, in the top-right corner, click the **Settings** tab. In the **Settings** page, under the **Private network** sub-section, click the toggle to enable your machine to use a private network. In the **Private network** sub-section, click the drop-down menu, select the private network you want to add your machine to, then click **ATTACH**. If you have not created any other private networks on your Paperspace account, [create another private network](#create) you can use to migrate your machines to.