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

# Private Networks

> How to create a private network between your virtual servers in one city, attach and detach servers, and delete the network in the Ascienth console.

## Overview

A private network connects your servers in the same city over an isolated network with its own private address range. Each server on the network gets an extra network interface and an address on that range, and can reach the other servers on it directly.

Traffic on a private network is not counted toward your bandwidth quota.

Open the Ascienth console at [https://console.advinservers.com](https://console.advinservers.com) and click "Private Networks" under "Networking" in the left sidebar. Each server also has a "Private Network" tab.

<Note>
  A private network only connects servers in **one city**. You can only create a network in a city where you already have a server, and only servers in the same team as the network can join it.
</Note>

Team members need these permissions:

| Permission | What it allows |
| - | - |
| `View networking` | See private networks and their servers. |
| `Change networking` | Create networks, rename them, and attach or detach servers. |
| `Delete networking resources` | Delete a private network. |

## Creating a Network

<Steps>
  <Step title="Open the Private Networks page">
    Click "Private Networks" in the left sidebar, then click `Create Network`.
  </Step>

  <Step title="Fill in the details">
    * `Network name`: up to 64 characters. Use letters, digits, spaces, dashes, underscores or dots.
    * `City`: the city the network is in. Only cities where you have a server are listed.
    * `Address range`: the private range the network uses, in CIDR notation. We fill in a free range for you, which you can change.
  </Step>

  <Step title="Create it">
    Click `Create`. The network appears in the list with its `Range`, `City` and number of `Servers`.
  </Step>
</Steps>

The address range must:

* be inside `10.0.0.0/8`, `172.16.0.0/12` or `192.168.0.0/16`,
* have a prefix between `/8` and `/30`, written with no bits set below the prefix (for example `10.20.30.0/24`, not `10.20.30.5/24`),
* not overlap another network your team already has in that city.

## Adding Servers

You can add a server from the network's page or from the server's own tab.

### From the Network's Page

<Steps>
  <Step title="Open the network">
    Click the network in the list. It opens on the "Servers" tab.
  </Step>

  <Step title="Add a server">
    Click `Add Server` and choose the `Server`. Only your servers in the network's city that are not already on it are listed.
  </Step>

  <Step title="Choose its address">
    Under `Address`, pick `Assign one automatically`, or `Choose an address` and enter an `IP address` on the network's range. Click `Add`.
  </Step>
</Steps>

### From the Server's Private Network Tab

<Steps>
  <Step title="Open the tab">
    Click your server, then the "Private Network" tab, and click `Add Private Network`.
  </Step>

  <Step title="Pick or create a network">
    Choose a network from the `Network` menu. Under `IP Address`, pick `Automatic` or `Manual` and enter the address you want.

    To start a new network instead, choose `Create a new network` and enter a `Network name`. We pick a free address range for it in the server's city and add the server to it.
  </Step>

  <Step title="Confirm">
    Click `Add`.
  </Step>
</Steps>

The server's status shows `Attaching` while it is being added, then `Attached`.

<Warning>
  The private interface comes up the next time the server reboots. Reboot the server after adding it to a network.
</Warning>

A server can be on several private networks at once. The address you choose must be on the network's range, and no two servers on a network can share an address. The first and last addresses of the range cannot be used.

## Detaching a Server

* From the network's "Servers" tab, click the menu at the end of the server's row and choose `Detach from network`.
* From the server's "Private Network" tab, click the menu at the end of the network's row and choose `Detach`.

Confirm in the dialog. The server loses its interface on that network, and its address goes back to the range. Detaching runs in the background, and the interface disappears from the server on its next reboot. The network and its other servers are not affected.

## Renaming a Network

Open the network and click the "Settings" tab. Change the `Name` and click `Save`. The address range and city cannot be changed after the network is created.

## Deleting a Network

Open the network and click the "Delete" tab, then `Delete`. You can also choose `Delete` from the menu on the "Private Networks" page or on a server's "Private Network" tab. Type the network's name to confirm.

<Danger>
  Deleting a network detaches every server on it, removes their private network connections and deletes the network. This cannot be undone.
</Danger>

## Frequently Asked Questions

<AccordionGroup>
  <Accordion title="Does the firewall filter traffic on a private network?">
    No. The console [firewall](/guides/firewall) does not filter private network traffic. Use a firewall inside your servers if you need to restrict it.
  </Accordion>

  <Accordion title="Can I connect servers in different cities?">
    No. A private network only spans one city. A server can only join a network in its own city.
  </Accordion>

  <Accordion title="Why is my server not listed when I add a server?">
    Only your servers in the network's city and in the same team are listed, and only if they are not already on the network.
  </Accordion>

  <Accordion title="I added my server, but I cannot see the new interface.">
    The interface is added on the server's next reboot. Reboot it from the console and check again.
  </Accordion>
</AccordionGroup>

## Using the API

Private networks are under `/api/v1/client/private-networks`, and a server's networks are under `/api/v1/client/servers/<SERVER_ID>/private-networks`. Your API key needs `network.read` to read them, `network.update` to create networks and attach or detach servers, and `network.delete` to delete them.

```bash theme={null}
curl -X POST https://console.advinservers.com/api/v1/client/servers/<SERVER_ID>/private-networks/<NETWORK_ID>/attach \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"ip_address": "10.0.0.10"}'
```

Leave out `ip_address` to have the lowest free address assigned. Creating a network through the API does not add any server to it, so attach each server afterwards. See the [API introduction](/api-reference/introduction) for how to create a key and for the full list of endpoints.


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