# Exoscale Documentation — VPC

> Exoscale VPC documentation: isolated private networks per zone with routed Subnets, custom routes and Security Group filtering for your instances.

---

url: https://community.exoscale.com/product/networking/vpc/

---

# VPC

- [Quick Start - VPC](https://community.exoscale.com/product/networking/vpc/quick-start/index.md) - Get started quickly with a guided setup to achieve your first successful use of the service, including the required steps and configuration.
- [Overview - VPC](https://community.exoscale.com/product/networking/vpc/overview/index.md) - Terminology and key features at a glance, learn the core concepts, capabilities, and options of this service before you dive deeper.
- [How-To - VPC](https://community.exoscale.com/product/networking/vpc/how-to/index.md) - Step-by-step guides to configure the service and use specific features, with clear instructions for common tasks and problem solving.
- [Service Boundaries - VPC](https://community.exoscale.com/product/networking/vpc/service-boundaries/index.md) - Service boundaries: quotas, limits, and the guaranteed service levels (SLA) for this product, including key constraints to plan and operate reliably.
- [Reference - VPC](https://community.exoscale.com/product/networking/vpc/reference/index.md) - Reference documentation for API, CLI, and tools, browse comprehensive details, parameters, commands, and integration notes.
- [Recipes - VPC](https://community.exoscale.com/product/networking/vpc/recipes/index.md) - Informational, concise guides showing how to integrate with external tools and solve specific scenarios.

---

url: https://community.exoscale.com/product/networking/vpc/quick-start/

---

# Quick Start - VPC

## Prerequisites
- **Exoscale CLI**
  download the latest binary for macOS, Linux or Windows from [GitHub](https://github.com/exoscale/cli/releases/latest)
- **Exoscale Account**
  sign in or [register](https://portal.exoscale.com/register).
- **API Key/Secret**
  configured via the CLI with `exo config`.
- **SSH Key**
  registered in your Exoscale account, to connect to the instances.


## First Steps via CLI

### Create a VPC

Create a VPC named `my-first-vpc`:
```console
$ exo networking vpc create my-first-vpc
 ✔ Creating VPC "my-first-vpc"... 0s
┼─────────────┼──────────────────────────────────────┼
│     VPC     │                                      │
┼─────────────┼──────────────────────────────────────┼
│ ID          │ cdaa9663-634d-4abd-94a3-fc2b32c4854a │
│ Name        │ my-first-vpc                         │
│ Description │                                      │
│ Default     │ false                                │
│ Zone        │ ch-gva-2                             │
│ Created At  │ 2026-09-09 07:31:15 +0000 UTC        │
│ Labels      │ n/a                                  │
│ Subnets     │ -                                    │
┼─────────────┼──────────────────────────────────────┼
```

### Create a Subnet

Add a Subnet to the VPC with the chosen private IPv4 range:
```console
$ exo networking vpc subnet create my-first-vpc my-first-subnet --address-family inet4 --address-space private --ipv4-block 10.42.0.0/16
 ✔ Creating Subnet "my-first-subnet"... 0s
┼────────────────┼──────────────────────────────────────┼
│   VPC SUBNET   │                                      │
┼────────────────┼──────────────────────────────────────┼
│ ID             │ d557ef4e-c481-4ba4-872e-4c6b53705be8 │
│ Name           │ my-first-subnet                      │
│ Description    │                                      │
│ Zone           │ ch-gva-2                             │
│ Created At     │ 2026-09-09 07:32:39 +0000 UTC        │
│ Address Family │ inet4                                │
│ Address Space  │ private                              │
│ IPv4 Block     │ 10.42.0.0/16                         │
│ Labels         │ n/a                                  │
│ Instances      │ -                                    │
┼────────────────┼──────────────────────────────────────┼
```

### Create and Attach Instances

Create the first instance:
```console
$ exo compute instance create instance-A --template "Linux Ubuntu 26.04 LTS 64-bit" --ssh-key my-ssh-key
 ✔ Creating instance "instance-A"... 21s
┼─────────────────────────────────────────┼──────────────────────────────────────┼
│            COMPUTE INSTANCE             │                                      │
┼─────────────────────────────────────────┼──────────────────────────────────────┼
│ ID                                      │ 324d7bb3-0a1c-4bd8-abc5-9a1cd8109196 │
│ Name                                    │ instance-A                           │
│ Creation Date                           │ 2026-09-09 07:34:26 +0000 UTC        │
│ Instance Type                           │ standard.medium                      │
│ Template                                │ Linux Ubuntu 26.04 LTS 64-bit        │
│ Zone                                    │ ch-gva-2                             │
│ Anti-Affinity Groups                    │ n/a                                  │
│ Deploy Target                           │ -                                    │
│ Security Groups                         │ default                              │
│ Private Instance                        │ No                                   │
│ Elastic IPs                             │ n/a                                  │
│ Public IP                               │ inet4                                │
│ IP Address                              │ 85.217.161.236                       │
│ IPv6 Address                            │ -                                    │
│ Vpc                                     │                                      │
│ Vpc Subnets                             │ n/a                                  │
│ Private Networks                        │ n/a                                  │
│ SSH Keys                                │ n/a                                  │
│ Disk Size                               │ 50 GiB                               │
│ State                                   │ running                              │
│ Labels                                  │ n/a                                  │
│ Secure Boot                             │ false                                │
│ Tpm                                     │ false                                │
│ Reverse DNS                             │                                      │
│ Application-Consistent Snapshot enabled │ false                                │
┼─────────────────────────────────────────┼──────────────────────────────────────┼
```

Attach it to the Subnet:
```console
$ exo compute instance attach-to-subnet instance-A my-first-vpc my-first-subnet
 ✔ Attaching instance "instance-A" to Subnet "my-first-subnet"... 3s
┼─────────────────────────────────────────┼──────────────────────────────────────┼
│            COMPUTE INSTANCE             │                                      │
┼─────────────────────────────────────────┼──────────────────────────────────────┼
│ ID                                      │ 324d7bb3-0a1c-4bd8-abc5-9a1cd8109196 │
│ Name                                    │ instance-A                           │
│ Creation Date                           │ 2026-09-09 07:34:26 +0000 UTC        │
│ Instance Type                           │ standard.medium                      │
│ Template                                │ Linux Ubuntu 26.04 LTS 64-bit        │
│ Zone                                    │ ch-gva-2                             │
│ Anti-Affinity Groups                    │ n/a                                  │
│ Deploy Target                           │ -                                    │
│ Security Groups                         │ default                              │
│ Private Instance                        │ No                                   │
│ Elastic IPs                             │ n/a                                  │
│ Public IP                               │ inet4                                │
│ IP Address                              │ 85.217.161.236                       │
│ IPv6 Address                            │ -                                    │
│ Vpc                                     │ my-first-vpc                         │
│ Vpc Subnets                             │ my-first-subnet 10.42.145.150        │
│ Private Networks                        │ n/a                                  │
│ SSH Keys                                │ n/a                                  │
│ Disk Size                               │ 50 GiB                               │
│ State                                   │ running                              │
│ Labels                                  │ n/a                                  │
│ Secure Boot                             │ false                                │
│ Tpm                                     │ false                                │
│ Reverse DNS                             │                                      │
│ Application-Consistent Snapshot enabled │ false                                │
┼─────────────────────────────────────────┼──────────────────────────────────────┼
```

Create and attach a second instance:
```console
$ exo compute instance create instance-B --template "Linux Ubuntu 26.04 LTS 64-bit" --ssh-key my-ssh-key
$ exo compute instance attach-to-subnet instance-B my-first-vpc my-first-subnet
```

### Allow Traffic Between the Instances

Create a Security Group that allows the instances to ping each other and accepts SSH connections from any address:
```console
$ exo compute security-group create my-sg
[...]
$ exo compute security-group rule add my-sg --protocol tcp --flow ingress --port 22 --network 0.0.0.0/0
[...]
$ exo compute security-group rule add my-sg --protocol icmp --flow ingress --icmp-type 8 --security-group my-sg
 ✔ Adding rule to Security Group "my-sg"... 24s
┼──────────────────┼────────────────────────────────────────────────────────────────────────────────────────────┼
│  SECURITY GROUP  │                                                                                            │
┼──────────────────┼────────────────────────────────────────────────────────────────────────────────────────────┼
│ ID               │ 699977e4-0403-478c-9b61-7dd347643e98                                                       │
│ Name             │ my-sg                                                                              │
│ Description      │                                                                                            │
│ Ingress Rules    │                                                                                            │
│                  │   dc712e4c-9998-4823-a49e-edc2413a8b53      ICMP   SG:my-sg   ICMP code:0 type:8   │
│                  │   718f4c0b-711f-4adb-a84b-29b67b458de3      TCP    0.0.0.0/0          22                   │
│                  │                                                                                            │
│ Egress Rules     │ -                                                                                          │
│ External Sources │ -                                                                                          │
│ Instances        │ -                                                                                          │
┼──────────────────┼────────────────────────────────────────────────────────────────────────────────────────────┼
```

Add both instances to the Security Group:
```console
$ exo compute instance security-group add instance-A my-sg
$ exo compute instance security-group add instance-B my-sg
```


### Confirm Private Connectivity

Connect to `instance-A` over SSH and ping the VPC address of `instance-B`:

```
ubuntu@instance-A:~$ ping 10.42.13.243
PING 10.42.13.243 (10.42.13.243) 56(84) bytes of data.
64 bytes from 10.42.13.243: icmp_seq=1 ttl=64 time=0.442 ms
64 bytes from 10.42.13.243: icmp_seq=2 ttl=64 time=0.340 ms
64 bytes from 10.42.13.243: icmp_seq=3 ttl=64 time=0.511 ms
^C
--- 10.42.13.243 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2032ms
rtt min/avg/max/mdev = 0.340/0.431/0.511/0.070 ms
```

The Security Group blocks traffic on other protocols or ports until you add a rule to allow it.

## First Steps via Portal

This quick start guide will demonstrate how to create a first VPC and one Subnet via the Portal.

## Create a VPC
Navigate to the [Networking view and the VPC tab](https://portal.exoscale.com/networking/vpc):

![](vpc-menu.png "Exoscale Networking navigation menu")

Click the `Add` button on the top, then enter the location of the VPC, its name and the other optional fields if required

![](vpc-create-vpc.png "Exoscale VPC creation")

> [!NOTE]
	Even if you haven't created any VPC, you'll see that you already have one default VPC in each zone
	![](vpc-default-list.png "Exoscale list of default VPCs")

## Create a VPC Subnet

You can then create a Subnet in your VPC. Either by clicking on the VPC and creating a Subnet there, or by going to the Subnet list and clicking the `Add` button at the top

When creating a Subnet, you need to chose its name and IP range

![](vpc-create-subnet.png "Exoscale Subnet creation")

## Attach an instance to the Subnet

Once this is done, you can now attach instance to this Subnet. This can either be done from the
Subnet view, or directly from the instance view.

![](vpc-attach-instance-from-subnet.png "Exoscale Instance attachment from Subnet page")

![](vpc-attach-instance-from-instance.png "Exoscale Instance attachment from Instance page")

## Next Steps

- [Inspect VPC Subnet attachments](https://community.exoscale.com/product/networking/vpc/how-to/inspect-subnet-attachments/index.md)
- [Configure cross-Subnet communication](https://community.exoscale.com/product/networking/vpc/how-to/cross-subnet-communication/index.md)
- [Use VPC routing rules](https://community.exoscale.com/product/networking/vpc/how-to/using-routing-rules/index.md)
- [Explore the VPC API](https://community.exoscale.com/reference/api/networking/vpc/index.md)

---

url: https://community.exoscale.com/product/networking/vpc/overview/

---

# Overview - VPC

## Architecture

An __Exoscale VPC (Virtual Private Cloud)__ is a private, isolated network that you
define and operate yourself inside a single Exoscale zone. It gives your Compute
instances private addresses of your choosing, routing between the segments
of that VPC, and complete traffic isolation from every other organization on the
platform.

A VPC is an empty container until you carve it into __Subnets__. Each Subnet holds
one private IPv4 block. Instances can be attached to a Subnet and receive an address
from that block. All Subnets of the same VPC can reach each other by default, and
you can add your own __routes__ to steer traffic to appliances running inside the
VPC.

![An example of an infrastructure using VPC](vpc.drawio.svg "An example of an infrastructure using VPC")

### A Routed Network

A VPC is a __layer 3 (routed) network__, not a layer 2 segment: instead of being
plugged into a shared virtual switch, each attached interface is connected to its own
port on a distributed virtual router. Every packet — including traffic between two
instances of the same Subnet — is routed by the platform. This means:

- Only IPv4 unicast traffic is carried. Broadcast and multicast are not forwarded, so
  protocols that rely on them (mDNS or NetBIOS discovery, VRRP/keepalived in multicast
  mode, your own DHCP or PXE servers, non-IPv4 ethertypes) do not work inside a VPC.
- Instances are not on a common ethernet segment, so they never see each other's MAC
  addresses: ARP is answered by the virtual router port. Bridging an interface into a
  VPC, or emitting traffic from an unknown MAC address, is not possible.
- Traffic is only delivered to addresses the platform knows about — a Subnet block or a destination
  covered by a route. Forwarding through an instance therefore requires a [route](#routing)
  pointing at it (either an implicit or a custom one).


### Isolation and Addressing

Each VPC is backed by a dedicated network overlay, so traffic never leaves the
boundary of the VPC and is never visible to other VPCs — including other VPCs of
your own organization. There is no shared address space: two VPCs may use the same
private ranges without conflicting.

Addressing is entirely under your control, as long as the subnet IPv4 blocks are contained in the
[RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) range (`10.0.0.0/8`, `172.16.0.0/12` or
`192.168.0.0/16`)

### Attaching Instances

A Compute instance joins a VPC by being attached to one of its Subnets. The
attachment adds a network interface to the instance, with an IPv4 address either
picked automatically from the Subnet block, or specified by you at attachment time.
No extra configuration is required inside the instance as everything is configured via DHCP.

Attachment and detachment are performed while the instance is running — no reboot is
required. An instance may be attached to several Subnets of the same VPC at once,
but it cannot be attached to two different VPCs.


### Routing

There are two kinds of route objects:

* __Implicit routes__ or __VPC route__ are created for you whenever a Subnet is added, so every
  Subnet of a VPC can reach every other Subnet of that VPC without any configuration. Those routes
  are managed by Exoscale and cannot be modified directly
* __Custom routes__ or __Subnet routes__ are attached to a specific Subnet and apply to the traffic of the instances in
  that Subnet. A route is a destination CIDR plus a target expressed as `ip=<IPv4 address>` — the
  next hop that should receive the traffic.

Custom routes are what you use to place an appliance in the traffic path: a firewall,
a NAT or VPN gateway, an IDS, or any instance you have set up to forward packets.
Traffic destined outside the VPC (including internet-bound traffic) is only possible
through such an instance, since a VPC has no gateway of its own.

For a given instance, the custom routes that come from its subnet and the implicit routes that come
from the VPC are merged and applied. The most precise route takes priority and for route with the
same destination, the subnet one is preferred.

### Traffic Filtering

VPC interfaces are filtered by the
[Security Groups](https://community.exoscale.com/product/networking/security-group/index.md) of the instance,
exactly like public interfaces. Rules therefore apply to the private traffic of your
instances, and can reference other Security Groups or CIDR blocks of your Subnets.

## Terminology

VPC
: A private, isolated network scoped to a single organization and a single zone. It
  is a container for Subnets and routes; it carries no address block itself.

Default VPC
: A VPC that is provisioned automatically for your organization. It behaves like any
  other VPC but cannot be deleted. You have one default VPC per zone.

Subnet
: A segment of a VPC, defined by a single private IPv4 block (its `ipv4-block`).
  Instances are attached to Subnets, not to the VPC directly. A Subnet is where the
  addressing, the attachments and the custom routes live.

Address family
: The protocol version used by a Subnet. Only `inet4` (IPv4) is supported today.

Address space
: The kind of addressing used by a Subnet. Only `private` is supported today, which
  restricts blocks to the RFC 1918 ranges.

Attachment
: The link between a Compute instance and a Subnet. It materialises as a network
  interface on the instance, holding one IPv4 address from the Subnet block.

Route
: A rule to direct VPC traffic to specific target. Can be either a VPC route or a Subnet route.
  
Subnet Route / Custom route
: A rule directing traffic for a destination CIDR to a target next hop, expressed as
  `ip=<IPv4 address>`. Routes are scoped to a Subnet.

VPC route / Implicit route
: A route created and maintained by the platform when a Subnet is added, ensuring
  reachability between all the Subnets of a VPC.

## Features

Private, isolated networking
: Your VPC traffic stays inside your VPC. Isolation is enforced by the platform at the
  network layer, with no address space shared between VPCs.

Your own addressing plan
: Choose your Subnet blocks in the RFC 1918 ranges, size them for your workloads, and
  assign fixed private IPv4 addresses to the instances that need them.

Multi-Subnet segmentation
: Split a VPC into up to 50 Subnets to separate tiers, environments or tenants, while
  keeping them mutually reachable and centrally managed.

Custom routing
: Add routes to direct traffic through your own appliances — firewalls, NAT or VPN
  gateways, or any instance acting as a router — without touching the configuration of
  the workloads behind them.

Live attachment
: Attach and detach running instances from Subnets without a reboot, so networking can
  follow your deployments instead of driving them.

Security Group filtering
: Reuse the Security Groups you already apply to your instances to filter private
  traffic inside the VPC.

Labels
: VPCs and Subnets support [labels](https://community.exoscale.com/product/compute/instances/how-to/labels/index.md),
  so they can be organised and selected like the rest of your Exoscale resources.

Full API, CLI and Terraform coverage
: Everything described here is available through the
  [API](https://community.exoscale.com/reference/api/networking/vpc/index.md) and the
  [`exo networking vpc` commands](https://community.exoscale.com/reference/cli/exo/networking/vpc/index.md), so VPCs
  can be created and wired up from your infrastructure-as-code pipelines.

---

url: https://community.exoscale.com/product/networking/vpc/how-to/

---

# How-To - VPC

Step-by-step guides to configure the service and use specific features, with clear instructions for common tasks and problem solving.

- [Configuring DHCP Options](https://community.exoscale.com/product/networking/vpc/how-to/configuring-dhcp-options/index.md) - How to configure DHCP Options for VPC, including DNS servers, domain search, and NTP servers.
- [Cross Subnet Communication](https://community.exoscale.com/product/networking/vpc/how-to/cross-subnet-communication/index.md) - How to communicate between instances on different subnets of the same VPC
- [Using Routing Rules](https://community.exoscale.com/product/networking/vpc/how-to/using-routing-rules/index.md) - How VPC and Subnet routes work, how a route is selected, and how to steer traffic through an appliance or isolate Subnets.
- [Inspect VPC Subnet Attachments](https://community.exoscale.com/product/networking/vpc/how-to/inspect-subnet-attachments/index.md) - List the instances attached to a VPC Subnet and check the network interface and DHCP configuration inside an instance.

---

url: https://community.exoscale.com/product/networking/vpc/how-to/configuring-dhcp-options/

---

# Configuring DHCP Options

With VPC, it's possible to configure the virtual DHCP server to pass some DHCP options.
This can be useful to easily configure your instances from a single place.

The following options are available:

- [DHCP Option 6] DNS Servers.
- [DHCP Option 42] NTP Servers.
- [DHCP Option 119] Domain Search List.

> [!WARNING]
> These DHCP options apply globally to the entire instance, not just the VPC interface.
> For example, depending on your instance configuration, all DNS queries may be
> forwarded to the DNS server set in the VPC config.

## Set DHCP Options when creating a VPC

You can create a VPC directly with DHCP options configured.

```console
$ exo networking vpc create my-vpc --dns-server 8.8.8.8 --dns-server 1.1.1.1 --ntp-server 162.159.200.1 --ntp-server 216.239.35.0 --domain-search myorg.internal --domain-search exoscale.gva2.internal 
 ✔ Creating VPC "my-vpc"... 0s
┼──────────────┼────────────────────────────────────────────────────────────┼
│     VPC      │                                                            │
┼──────────────┼────────────────────────────────────────────────────────────┼
│ ID           │ ebd4b6c9-3a10-4850-983f-2411b650fa1f                       │
│ Name         │ my-vpc                                                     │
│ Description  │                                                            │
│ Default      │ false                                                      │
│ Zone         │ ch-gva-2                                                   │
│ Created At   │ 2026-10-27 15:32:22 +0000 UTC                              │
│ DHCP options │                                                            │
│              │   DNS Servers     8.8.8.8, 1.1.1.1                         │
│              │   NTP Servers     162.159.200.1, 216.239.35.0              │
│              │   Domain Search   myorg.internal, exoscale.gva2.internal   │
│              │                                                            │
│ Labels       │ n/a                                                        │
│ Subnets      │ -                                                          │
┼──────────────┼────────────────────────────────────────────────────────────┼
```

Then you can create a subnet and attach an instance to it.

```console
$ exo networking vpc subnet create my-vpc my-subnet --address-family inet4 --address-space private --ipv4-block 10.0.0.0/24
 ✔ Creating Subnet "my-subnet"... 0s
┼────────────────┼──────────────────────────────────────┼
│   VPC SUBNET   │                                      │
┼────────────────┼──────────────────────────────────────┼
│ ID             │ 22a213de-8805-4d85-a0d2-ec0f01833bc6 │
│ Name           │ my-subnet                            │
│ Description    │                                      │
│ Zone           │ ch-gva-2                             │
│ Created At     │ 2026-10-27 15:52:55 +0000 UTC        │
│ Address Family │ inet4                                │
│ Address Space  │ private                              │
│ IPv4 Block     │ 10.0.0.0/24                          │
│ Labels         │ n/a                                  │
│ Instances      │ -                                    │
┼────────────────┼──────────────────────────────────────┼

$ exo compute instance attach-to-subnet my-instance my-vpc my-subnet 
 ✔ Attaching instance "my-instance" to Subnet "my-subnet"... 3s
┼─────────────────────────────────────────┼──────────────────────────────────────┼
│            COMPUTE INSTANCE             │                                      │
┼─────────────────────────────────────────┼──────────────────────────────────────┼
│ ID                                      │ 325b1bc1-5867-4c28-8aa0-d4ed49441e8f │
│ Name                                    │ my-instance                          │
│ Creation Date                           │ 2026-10-27 15:50:18 +0000 UTC        │
│ Instance Type                           │ standard.medium                      │
│ Template                                │ Linux Ubuntu 26.04 LTS 64-bit        │
│ Zone                                    │ ch-gva-2                             │
│ Anti-Affinity Groups                    │ n/a                                  │
│ Deploy Target                           │ -                                    │
│ Security Groups                         │ default                              │
│ Private Instance                        │ No                                   │
│ Elastic IPs                             │ n/a                                  │
│ Public IP                               │ inet4                                │
│ IP Address                              │ 85.217.162.215                       │
│ IPv6 Address                            │ -                                    │
│ Vpc                                     │ my-vpc                               │
│ Vpc Subnets                             │ my-subnet 10.0.0.143                 │
│ Private Networks                        │ n/a                                  │
│ Ip Forwarding                           │ false                                │
│ SSH Keys                                │ mykey                                │
│ Disk Size                               │ 50 GiB                               │
│ State                                   │ running                              │
│ Labels                                  │ n/a                                  │
│ Secure Boot                             │ false                                │
│ Tpm                                     │ false                                │
│ Reverse DNS                             │                                      │
│ Application-Consistent Snapshot enabled │ false                                │
┼─────────────────────────────────────────┼──────────────────────────────────────┼
```

Finally you can verify that the DHCP options are correctly propagated to the instances. For instances using systemd-networkd as network manager you can do:

```console
$ networkctl status eth1
● 3: eth1
                   Link File: /usr/lib/systemd/network/99-default.link
                Network File: /run/systemd/network/zzzz-dracut-default.network
                       State: routable (configured)
                Online state: online                                          
                        Type: ether
                        Path: pci-0000:00:06.0
                      Driver: virtio_net
                      Vendor: Red Hat, Inc.
                       Model: Virtio network device
           Alternative Names: enp0s6
                              ens6
                              enx0e000006432f
            Hardware Address: 0e:00:00:06:43:2f
                         MTU: 1500 (min: 68, max: 65535)
                       QDisc: mq
IPv6 Address Generation Mode: eui64
    Number of Queues (Tx/Rx): 2/2
            Auto negotiation: no
                     Address: 10.0.0.143 (DHCPv4 via 10.0.0.1)
                              fe80::c00:ff:fe06:432f
                         DNS: 8.8.8.8
                              1.1.1.1
              Search Domains: myorg.internal
                              exoscale.gva2.internal
                         NTP: 162.159.200.1
                              216.239.35.0
           Activation Policy: up
         Required For Online: yes
            DHCPv4 Client ID: 0e:00:00:06:43:2f
          DHCPv6 Client DUID: DUID-EN/Vendor:0000ab11b02448dc497bb0e5

Oct 27 15:54:11 my-instance systemd-networkd[1004]: eth1: Configuring with /run/systemd/network/zzzz-dracut-default.network.
Oct 27 15:54:11 my-instance systemd-networkd[1004]: eth1: Link UP
Oct 27 15:54:11 my-instance systemd-networkd[1004]: eth1: Gained carrier
Oct 27 15:54:11 my-instance systemd-networkd[1004]: eth1: DHCPv4 address 10.0.0.143/32 acquired from 10.0.0.1
Oct 27 15:54:13 my-instance systemd-networkd[1004]: eth1: Gained IPv6LL
```

## Set DHCP Options of an existing VPC

> [!WARNING]
> For the moment, you can only update DHCP Options on VPCs with no instance attached.
> Support for all VPCs is coming soon.

```console
# Update the VPC to keep only one domain search

$ exo networking vpc update my-vpc --domain-search myorg.internal       
┼──────────────┼─────────────────────────────────────────────────┼
│     VPC      │                                                 │
┼──────────────┼─────────────────────────────────────────────────┼
│ ID           │ ebd4b6c9-3a10-4850-983f-2411b650fa1f            │
│ Name         │ my-vpc                                          │
│ Description  │                                                 │
│ Default      │ false                                           │
│ Zone         │ ch-gva-2                                        │
│ Created At   │ 2026-10-27 15:32:22 +0000 UTC                   │
│ DHCP options │                                                 │
│              │   DNS Servers     8.8.8.8, 1.1.1.1              │
│              │   NTP Servers     162.159.200.1, 216.239.35.0   │
│              │   Domain Search   myorg.internal                │
│              │                                                 │
│ Labels       │ n/a                                             │
│ Subnets      │                                                 │
│              │   my-subnet   10.0.0.0/24                       │
│              │                                                 │
┼──────────────┼─────────────────────────────────────────────────┼
```

## Limits

The DHCP options are subject to the following limits per VPC:

- DNS Servers: maximum 5 allowed.
- NTP Servers: maximum 5 allowed.
- Domain Search List: limited to 255 octets post RFC3397 compression.

---

url: https://community.exoscale.com/product/networking/vpc/how-to/cross-subnet-communication/

---

# Cross Subnet Communication

Two instances in the same VPC but in different subnets can communicate by default, thanks to the
VPC routes created along with each subnet (see
[Using Routing Rules](https://community.exoscale.com/product/networking/vpc/how-to/using-routing-rules/index.md)), as long
as the Security Group rules allow this traffic.

However, due to a current limitation of the VPC product, this requires a small configuration inside
the operating system of your instances: packets destined for the VPC must leave through a VPC
interface, not through the public interface.

For example if you have `instance-A` in the subnet `10.1.0.0/16` and `instance-B` in the subnet
`10.2.0.0/16`, you need to run the following commands:

```console
ubuntu@instance-A:~$ sudo ip route add 10.2.0.0/16 via 10.1.0.1 dev eth1
```

```console
ubuntu@instance-B:~$ sudo ip route add 10.1.0.0/16 via 10.2.0.1 dev eth1
```

To simplify the configuration on the instance as much as possible, you could set a route for any
CIDR that contains the subnet, potentially using a CIDR that contains all your subnets so a single
route is enough rather than one per subnet.

Moreover, if you have different VPC interfaces in your instance, you can use any as the target of
this routing rule.


> [!NOTE]
> Add the following route to all instances that need cross-subnet communication
> ```console
> ubuntu@instance-X:~$ GW=$(ip route show dev eth1 scope link | awk '{print $1; exit}')
> ubuntu@instance-X:~$ sudo ip route add <CIDR_THAT_CONTAINS_ALL_SUBNETS> via $GW dev eth1
> ```

---

url: https://community.exoscale.com/product/networking/vpc/how-to/using-routing-rules/

---

# Using Routing Rules

Routes decide where the platform delivers a packet that leaves an instance through a VPC interface.
Every VPC comes with routes that make its Subnets reachable from each other.  Most of the time you
don't need to touch the VPC routing rules, but for some advanced use cases, you can add your own
routes to send traffic through an instance of your choice, such as a NAT gateway, a firewall, or a
VPN endpoint.


## How VPC Routing Works

### VPC Routes and Subnet Routes

A VPC has two kinds of routes:

|  | VPC route (implicit) | Subnet route (custom) |
| --------------------- | ----------------------------------------------- | ---------------------------------------------- |
| Created by | Exoscale, when a Subnet is added | You |
| Scope | Every Subnet of the VPC | The Subnet it is created in |
| Destination | The IPv4 block of the Subnet it was created for | Any IPv4 CIDR, including `0.0.0.0/0` |
| Target | `cidr=<Subnet block>` | `ip=<IPv4 address>` |
| Can be deleted | No, it is removed along with its Subnet | Yes |

A VPC route with the target `cidr=<block>` means *deliver the packet directly to its destination
address*. You will only see this target in the output of `exo networking vpc route list`. Routes you create always use
`ip=`.

```console
$ exo net vpc show my-first-vpc
┼─────────────┼──────────────────────────────────────┼
│     VPC     │                                      │
┼─────────────┼──────────────────────────────────────┼
│ ID          │ 53df4f25-365e-4d48-be28-45f5de1c0bd1 │
│ Name        │ my-first-vpc                         │
│ Description │                                      │
│ Default     │ false                                │
│ Zone        │ ch-gva-2                             │
│ Created At  │ 2026-08-12 07:32:45 +0000 UTC        │
│ Labels      │ n/a                                  │
│ Subnets     │                                      │
│             │   my-first-subnet    10.42.0.0/16    │
│             │   my-second-subnet   10.26.0.0/16    │
│             │                                      │
┼─────────────┼──────────────────────────────────────┼
$ exo net vpc route list my-first-vpc
┼──────────────────────────────────────┼──────┼──────────────┼───────────────────┼───────────────────────────────────────────────────────────────┼
│                  ID                  │ KIND │ DESTINATION  │      TARGET       │                          DESCRIPTION                          │
┼──────────────────────────────────────┼──────┼──────────────┼───────────────────┼───────────────────────────────────────────────────────────────┼
│ 052c8d9e-be35-4fea-9fc0-03925494612c │ Vpc  │ 10.26.0.0/16 │ cidr=10.26.0.0/16 │ Default route for subnet 366f2dab-f52b-46bb-a8e3-49220ef8b5ff │
│ b8b6b692-07c5-4118-9134-ed80bccaa604 │ Vpc  │ 10.42.0.0/16 │ cidr=10.42.0.0/16 │ Default route for subnet 1ea45a36-9085-4766-95a1-4397c208480a │
┼──────────────────────────────────────┼──────┼──────────────┼───────────────────┼───────────────────────────────────────────────────────────────┼
```

A Subnet route with the target `ip=<IPv4 address>` means *deliver the packet to this next hop*. The
packet is not modified. It reaches the next hop with its original destination address, and the next
hop decides what to do with it.

### Which Routes Apply to an Instance

Routes are evaluated when a packet leaves an instance through a VPC interface. For that interface,
the platform merges:

- all the VPC routes of the VPC, and
- the Subnet routes of the Subnet this interface is attached to.

If an instance is attached to several Subnets, each of its interfaces uses the routes of its own
Subnet and it's the instance's operating system that chooses the interface the packet leaves from.

Traffic in the other direction is routed with the routes of the replying instance's Subnet. Keep this
in mind when you insert an appliance in the path (see
[Keep routing symmetric](#keep-routing-symmetric)).

### How a Route Is Selected

When several routes match the destination of a packet:

1. The most specific route (the longest prefix) wins.
2. If two routes have the same destination, the Subnet route wins over the VPC route.
3. If no route matches, the packet is dropped.

Because of rule 2, you can override the implicit route to a Subnet by adding a Subnet route with
the same destination.

For example, suppose the instances of the Subnet `app` (`10.0.1.0/24`) see these routes:

| Kind | Destination | Target |
| -------- | --------------- | ------------------- |
| Vpc | `10.0.0.0/24` | `cidr=10.0.0.0/24` |
| Vpc | `10.0.1.0/24` | `cidr=10.0.1.0/24` |
| Vpc | `10.0.2.0/24` | `cidr=10.0.2.0/24` |
| Subnet | `0.0.0.0/0` | `ip=10.0.0.10` |
| Subnet | `10.0.2.0/24` | `ip=10.0.3.10` |

| Packet destination | Selected route | Delivered to |
| -------------------- | --------------------------------- | --------------------- |
| `10.0.1.25` | Vpc `10.0.1.0/24` | `10.0.1.25` |
| `10.0.0.40` | Vpc `10.0.0.0/24` | `10.0.0.40` |
| `10.0.2.7` | Subnet `10.0.2.0/24` (wins tie) | `10.0.3.10` |
| `1.1.1.1` | Subnet `0.0.0.0/0` | `10.0.0.10` |

## Preparing an Instance to Act as a Next Hop Router

The target of a Subnet route must be the VPC address of an instance attached to the same VPC. That
instance receives packets addressed to other machines and sends them back out with a source address
that is not its own. Four things must be in place for this to work.

**Ensure IP forwarding is enabled on the instance.** By default, the Exoscale platform drops any
packet an instance sends through a VPC interface with a source address that is not the instance's
own. An instance used as a next hop must be created with VPC IP forwarding enabled. This setting can
only be chosen when the instance is created.

```console
exo compute instance create gateway-vm --ip-forwarding
```


**Forwarding enabled in the operating system.** On Linux:

```console
ubuntu@appliance:~$ sudo sysctl -w net.ipv4.ip_forward=1
```

To keep this setting across reboots, add `net.ipv4.ip_forward=1` to a file in `/etc/sysctl.d/`.

**Security Group rules that allow the forwarded traffic.** Security Groups filter the next hop's
VPC interface like any other interface. Add ingress rules on the next hop for the traffic it should
forward, matching the source Subnets.

**Operating system routes that use the VPC interface.** This is the limitation described in
[Cross Subnet communication](https://community.exoscale.com/product/networking/vpc/how-to/cross-subnet-communication/index.md).
The operating system must send VPC-bound traffic through a VPC interface, not through the public
interface. This applies to the next hop and to the instances sending traffic to it.

> [!TIP]
> Attach your appliances to a dedicated Subnet. Subnet routes only apply to the Subnet they are
> created in, so the traffic you steer to an appliance is never sent back to the appliance itself.

## Managing Subnet Routes with the CLI

Create a Subnet route:

```console
$ exo networking vpc route create my-first-vpc \
	--subnet my-first-subnet \
	--destination 0.0.0.0/0 \
	--target ip=10.26.0.10 \
	--description "Some route to a home-made NAT gateway"
```

Now we can see this route in the list of routes of the subnet

```console
$ exo networking vpc route list my-first-vpc --subnet my-first-subnet
┼──────────────────────────────────────┼────────┼──────────────┼───────────────────┼───────────────────────────────────────────────────────────────┼
│                  ID                  │  KIND  │ DESTINATION  │      TARGET       │                          DESCRIPTION                          │
┼──────────────────────────────────────┼────────┼──────────────┼───────────────────┼───────────────────────────────────────────────────────────────┼
│ 052c8d9e-be35-4fea-9fc0-03925494612c │ Vpc    │ 10.26.0.0/16 │ cidr=10.26.0.0/16 │ Default route for subnet 366f2dab-f52b-46bb-a8e3-49220ef8b5ff │
│ b8b6b692-07c5-4118-9134-ed80bccaa604 │ Vpc    │ 10.42.0.0/16 │ cidr=10.42.0.0/16 │ Default route for subnet 1ea45a36-9085-4766-95a1-4397c208480a │
│ ad2a856f-0d23-475d-8635-41b5d7a89270 │ Subnet │ 0.0.0.0/0    │ ip=10.26.0.10     │ Some route to a home-made NAT gateway                         │
┼──────────────────────────────────────┼────────┼──────────────┼───────────────────┼───────────────────────────────────────────────────────────────┼
```

And if we list the routes of the other subnet, we can see that it isn't impacted by the route
```console
$ exo networking vpc route list my-first-vpc --subnet my-second-subnet
┼──────────────────────────────────────┼──────┼──────────────┼───────────────────┼───────────────────────────────────────────────────────────────┼
│                  ID                  │ KIND │ DESTINATION  │      TARGET       │                          DESCRIPTION                          │
┼──────────────────────────────────────┼──────┼──────────────┼───────────────────┼───────────────────────────────────────────────────────────────┼
│ 052c8d9e-be35-4fea-9fc0-03925494612c │ Vpc  │ 10.26.0.0/16 │ cidr=10.26.0.0/16 │ Default route for subnet 366f2dab-f52b-46bb-a8e3-49220ef8b5ff │
│ b8b6b692-07c5-4118-9134-ed80bccaa604 │ Vpc  │ 10.42.0.0/16 │ cidr=10.42.0.0/16 │ Default route for subnet 1ea45a36-9085-4766-95a1-4397c208480a │
┼──────────────────────────────────────┼──────┼──────────────┼───────────────────┼───────────────────────────────────────────────────────────────┼
```



Route changes apply to running instances without a reboot and are usually propagated within a minute.

## Keep Routing Symmetric

Each direction of a connection is routed by the Subnet of the instance that sends it. Suppose a
Subnet route on Subnet A sends the traffic for Subnet B through an appliance. If Subnet B has no
matching route, the replies from B follow the VPC route and go straight back to A, bypassing the
appliance. A stateful appliance, such as a firewall, that sees only half of a connection usually
drops it. When you insert an appliance between two Subnets, add a route pointing to it on both
sides.

## Example: Isolating Subnets from Each Other

By default, every Subnet of a VPC can reach every other Subnet. Security Groups are the main way to
restrict this traffic. If you want to be sure that two Subnets can never communicate, you can add
Subnet routes that point their traffic to an address where no instance will ever exist. Packets
sent to such a target are dropped by the platform, whatever the Security Group rules allow.

Use an address outside the RFC 1918 ranges as the target, for example `192.0.2.1` from the
documentation range defined in [RFC 5737](https://datatracker.ietf.org/doc/html/rfc5737). Subnet
blocks are always in the RFC 1918 ranges, so no instance can ever be attached with this address.

For example, take a VPC `my-vpc` with three Subnets:

- `subnet-a` (`10.1.0.0/16`)
- `subnet-b` (`10.2.0.0/16`)
- `subnet-c` (`10.3.0.0/16`)

To let `subnet-b` talk to both of the others while keeping `subnet-a` and `subnet-c` apart, add a
route on each side of the forbidden pair:

```console
$ exo networking vpc route create my-vpc \
	--subnet subnet-a \
	--destination 10.3.0.0/16 \
	--target ip=192.0.2.1 \
	--description "Isolate from subnet-c"
$ exo networking vpc route create my-vpc \
	--subnet subnet-c \
	--destination 10.1.0.0/16 \
	--target ip=192.0.2.1 \
	--description "Isolate from subnet-a"
```

Each route has the same destination as the VPC route of the other Subnet, so it takes precedence
(see [How a route is selected](#how-a-route-is-selected)). The other VPC routes are untouched:

| Between | Result |
| -------------------------- | --------- |
| `subnet-a` ↔ `subnet-b` | Allowed |
| `subnet-b` ↔ `subnet-c` | Allowed |
| `subnet-a` ↔ `subnet-c` | Dropped |
| Inside each Subnet | Allowed |

> [!NOTE]
> A route only applies to the traffic leaving the Subnet it is created in. With a route on one side
> only, connections still fail because the replies are dropped, but one-way traffic, such as UDP,
> still gets through from the other side. Add a route on both Subnets of the forbidden pair.

> [!WARNING]
> An instance attached to both `subnet-a` and `subnet-c` can still reach both Subnets directly
> through its own interfaces. Do not attach instances to both Subnets of a pair you want to isolate.

To allow `subnet-a` and `subnet-c` to communicate again, delete these two routes.

## Other Examples

The [VPC recipes](https://community.exoscale.com/product/networking/vpc/recipes/index.md) show more complete setups:

- [NAT gateway](https://community.exoscale.com/product/networking/vpc/recipes/nat-gateway/index.md)
- [Connecting a VPC to external networks](https://community.exoscale.com/product/networking/vpc/recipes/wireguard-gateway/index.md)

## Troubleshooting

When traffic doesn't get through, check that:

- A route matches the destination. Packets with no matching route are dropped, for example internet
  traffic from a Subnet without a `0.0.0.0/0` route,
- The target IP belongs to an instance attached to the VPC. Packets sent to any other target are
  dropped,
- The next hop was created with VPC IP forwarding enabled, and forwarding is enabled in its operating
  system,
- The Security Groups of the next hop and of the destination allow the traffic,
- The operating system of each instance sends the traffic through its VPC interface (`ip route get
  <destination>` shows the interface used).

---

url: https://community.exoscale.com/product/networking/vpc/how-to/inspect-subnet-attachments/

---

# Inspect VPC Subnet Attachments

Use these checks after attaching Compute instances to a VPC Subnet.

## List Instances Attached to the Subnet

Show the Subnet to see its attached instances and their VPC addresses:
```console
$ exo networking vpc subnet show my-first-vpc my-first-subnet
┼────────────────┼──────────────────────────────────────┼
│   VPC SUBNET   │                                      │
┼────────────────┼──────────────────────────────────────┼
│ ID             │ d557ef4e-c481-4ba4-872e-4c6b53705be8 │
│ Name           │ my-first-subnet                      │
│ Description    │                                      │
│ Zone           │ ch-gva-2                             │
│ Created At     │ 2026-09-09 07:32:39 +0000 UTC        │
│ Address Family │ inet4                                │
│ Address Space  │ private                              │
│ IPv4 Block     │ 10.42.0.0/16                         │
│ Labels         │ n/a                                  │
│ Instances      │                                      │
│                │   instance-A   10.42.145.150         │
│                │   instance-B   10.42.13.243          │
│                │                                      │
┼────────────────┼──────────────────────────────────────┼
```
## Check the VPC Interface and DHCP

Attaching a VPC Subnet creates a new virtual interface on the instance. View it with `ip a`:
```console
ubuntu@instance-A:~$ ip -c a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
	link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
	inet 127.0.0.1/8 scope host lo
	   valid_lft forever preferred_lft forever
	inet6 ::1/128 scope host noprefixroute
	   valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
	link/ether 06:88:42:00:00:bb brd ff:ff:ff:ff:ff:ff
	altname enp3s0
	altname enx0688420000bb
	inet 85.217.161.220/23 metric 100 brd 85.217.161.255 scope global eth0
	   valid_lft forever preferred_lft forever
	inet6 fe80::488:42ff:fe00:bb/64 scope link proto kernel_ll
	   valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
	link/ether 0e:00:00:01:90:26 brd ff:ff:ff:ff:ff:ff
	altname enp7s0
	altname enx0e0000019026
	inet 10.42.145.150/32 metric 1024 scope global dynamic eth1
	   valid_lft 86252sec preferred_lft 86252sec
	inet6 fe80::c00:ff:fe01:9026/64 scope link proto kernel_ll
	   valid_lft forever preferred_lft forever
```

The interface receives its IP address and configuration through DHCP. Modern templates, such as Ubuntu 26.04, start DHCP automatically. On older templates, start it with `dhcpcd` or `dhclient`, or configure netplan or your instance network manager.

---

url: https://community.exoscale.com/product/networking/vpc/service-boundaries/

---

# Service Boundaries - VPC

- [Limits and Quotas - VPC](https://community.exoscale.com/product/networking/vpc/service-boundaries/limits-and-quotas/index.md) - VPC Limitations and Quotas
- [SLA - VPC](https://community.exoscale.com/product/networking/vpc/service-boundaries/sla/index.md) - VPC Service Level Agreement

- [Pricing ↗︎](https://www.exoscale.com/pricing/)

---

url: https://community.exoscale.com/product/networking/vpc/service-boundaries/limits-and-quotas/

---

# Limits and Quotas - VPC

## Limits

| Usage | Limit |
| --------------------------------- | -------------------------- |
| Subnets per VPC | 50 |
| Subnet attachments per instance | 7 |
| Routes per subnet | 500 |
| Minimum subnet size (IPv4) | 8 addresses (*ie* a /29) |


In a VPC subnet, 6 addresses are reserved and can't be used as an instance IP. For example in the subnet `192.168.42.0/24` we reserve:
- The 1st / network address `192.168.42.0`
- The 2nd address `192.168.42.1`: The IP of the subnet gateway
- The 3rd address `192.168.42.2`: Reserved for future use
- The 4th address `192.168.42.3`: Reserved for future use
- The 5th address `192.168.42.4`: Reserved for future use
- The last / broadcast address `192.168.42.255`



> [!WARNING]
> An instance can only be part of one VPC


## Quotas


| Usage | Quota |
| ------- | ------- |
| VPC | 15 |

## Availability
VPC is available in all zones.

---

url: https://community.exoscale.com/product/networking/vpc/service-boundaries/sla/

---

# SLA - VPC

These product-specific SLAs define the Service Availability Target for Exoscale VPC. It applies to each Client using the Service. Capitalized terms used herein but not defined herein shall have the meanings set forth in the Exoscale Terms and Conditions or EUSA, whichever applies.

## SLA Definitions

| Metric | Target | Definition |
| -------- | -------- | ------------ |
| Service Availability for VPC | >= 99.95% Monthly Uptime Percentage | The percentage of time in a calendar month during which the Exoscale VPC network infrastructure is operational and carries supported IPv4 unicast traffic between attached instances according to the VPC's routes. Unavailability means that a failure of the Exoscale VPC network infrastructure prevents this traffic from reaching its destination. |

## Product Specifications

For detailed product features, technical specifications, and tutorials, please refer to the [Exoscale documentation](https://community.exoscale.com/product/networking/vpc/index.md).

## Client Responsibilities

While Exoscale is responsible for operating and maintaining the VPC network infrastructure, Clients remain responsible for the following:

- Planning Subnet address ranges and managing instance attachments.
- Configuring custom routes and any instances used as next-hop routers, firewalls, NAT gateways, or VPN gateways.
- Configuring Security Group rules, host firewalls, and instance network interfaces for VPC traffic.
- Monitoring and maintaining the availability of their instances, applications, and other components that use the VPC.

For a complete explanation of the shared responsibility framework between Exoscale and Clients, please see the [Exoscale Shared Responsibility Model documentation](https://community.exoscale.com/platform/compliance/shared-responsability-model/index.md).

## Exclusions

For the complete list of SLA exclusions, please refer to the [General Exoscale Terms and Conditions](https://www.exoscale.com/terms/) or [EUSA](https://www.exoscale.com/eusa/), whichever applies.

## Retribution

The standard retribution and SLA credit schemes apply for this product as described under [General Exoscale Terms and Conditions](https://www.exoscale.com/terms/) or [EUSA](https://www.exoscale.com/eusa/), whichever applies. In the event that the Monthly Uptime Percentage for Exoscale VPC falls below the committed Service Level Objective, the Client will be eligible for service credits as follows:

| Monthly Uptime Percentage | Service Credit Percentage of Monthly Service Fees for Affected Resources |
| -------- | -------- |
| from 99.95% to 98.3% | 50% |
| below 98.3% | 100% |

### Claim Service Credit

To request a service credit, refer to the Service Unavailability Credit section of the [Exoscale Terms and Conditions](https://www.exoscale.com/terms/) or the [EUSA](https://www.exoscale.com/eusa/), whichever applies.

---

url: https://community.exoscale.com/product/networking/vpc/reference/

---

# Reference - VPC

- [API VPC](https://community.exoscale.com/reference/api/networking/vpc/index.md) - All operations on VPC (external)
- [CLI VPC](https://community.exoscale.com/reference/cli/exo/networking/vpc/index.md) - All commands on VPC (external)

---

url: https://community.exoscale.com/product/networking/vpc/recipes/

---

# Recipes - VPC

Informational, concise guides showing how to integrate with external tools and solve specific scenarios.

- [Migrate from Private Networks to VPC](https://community.exoscale.com/product/networking/vpc/recipes/migrating-from-private-network/index.md) - Move instances from Private Networks to VPC without downtime by running both side by side and shifting traffic before decommissioning.
- [Use an Instance as a NAT Gateway](https://community.exoscale.com/product/networking/vpc/recipes/nat-gateway/index.md) - Let instances in a VPC Subnet reach external networks through a gateway instance that translates their addresses to its own public IP.
- [Connect a VPC to an External Network with WireGuard](https://community.exoscale.com/product/networking/vpc/recipes/wireguard-gateway/index.md) - Route traffic in both directions between a VPC Subnet and an external network.

---

url: https://community.exoscale.com/product/networking/vpc/recipes/migrating-from-private-network/

---

# Migrate from Private Networks to VPC

This guide is provided for informational purposes. Because it involves third party tooling we cannot guarantee things still work exactly as described here.

Exoscale doesn't migrate Private Networks to VPC automatically, but you can do it yourself without
downtime. An instance can be attached to a Private Network and to a VPC Subnet at the same time, so
the migration runs both networks side by side:

1. Attach every instance to a VPC Subnet in addition to its Private Network.
2. Move your clients to the VPC addresses, one service at a time.
3. Remove the Private Network once nothing uses it anymore.

The Private Network keeps working until the last step. If something goes wrong, you can roll back
at any point by pointing your clients back to the Private Network addresses.

## Before You Start

Private Networks and VPCs work differently on two points that are important to keep in mind.

### VPC Is a Routed Network

A Private Network is a layer 2 segment. A VPC is a [layer 3 network](https://community.exoscale.com/product/networking/vpc/overview/index.md) that only carries IPv4 unicast traffic. This means that a
few Private Network use cases can't be migrated without changes. These use cases include:

- IPv6 addresses on the Private Network.
- Broadcast or multicast, such as VRRP/keepalived in multicast mode, mDNS or NetBIOS discovery.
- Your own DHCP or PXE server.
- A virtual IP moved between instances with gratuitous ARP. In a VPC, ARP is answered by the
  platform, and an instance can only send traffic from its own VPC address unless it was created
  with IP forwarding.


### Security Groups Filter VPC Traffic

Security Group rules don't apply to traffic inside a Private Network, but they apply to VPC
interfaces. Traffic that flows freely on your Private Network today is dropped on the VPC until you
add specific rules that allow it. 



## Step 1: Plan and Create Your VPC Subnets

Create one Subnet for each Private Network you migrate, in the same zone as your instances. You can
create a new VPC or use the default VPC of the zone.

Give each Subnet an IPv4 block that doesn't overlap with the range of its Private Network, or with
any other range your instances use.

> [!WARNING]
> Don't reuse your Private Network range for the Subnet. While an instance is attached to both,
> overlapping ranges give its operating system two routes to the same destination, and traffic
> leaves through the wrong interface.


> [!TIP]
> Keep the host part of each address when you pick the new ones, for example `10.0.0.12` on the
> Private Network becomes `10.100.0.12` on the VPC. The mapping is then easy to apply to your
> configuration. Instances that use one of the reserved addresses (`.1` to `.4`) today need a new
> host number.

## Step 2: Allow Private Traffic in Security Groups

List the traffic that flows over your Private Network today, and add Security Group rules that
allow it before any of it moves to the VPC. Rules can target the Security Group of the clients or
the IPv4 block of a Subnet.

If a Security Group has egress rules, only the traffic they allow can leave its instances. Add
matching egress rules for the VPC traffic too.

If you want a quick way forward that matches the current behavior of Private Networks, you can add
all the instances of a given Private Network to one Security Group, with a self-referencing rule
that allows all traffic. The instances in this Security Group can then communicate freely, like
they did over the Private Network.


```console
$ exo compute security-group create subnet-internal-communication
$ exo compute security-group rule add subnet-internal-communication --protocol all --security-group subnet-internal-communication
```


## Step 3: Attach Your Instances to the Subnet

Attach each instance to its new VPC Subnet. You can choose its address yourself with the `--ipv4`
option, or let the platform pick a random one for you.

A new network interface appears in each instance and gets its address through DHCP. Check it with
`ip address`. On older templates, you might need to start the DHCP client on this interface
yourself, as described in the [Quick Start](https://community.exoscale.com/product/networking/vpc/quick-start/index.md).

Then make your services reachable on the VPC addresses as well:

- Services bound to a Private Network address must also listen on the VPC address.
- Host firewall rules (nftables, iptables, ufw) that reference the Private Network interface or
  range must be extended to the VPC ones.

Before moving to the next step, you can confirm that clients can reach the service over the VPC:

```console
ubuntu@app-1:~$ ip route get 10.100.0.12
ubuntu@app-1:~$ nc -zv 10.100.0.12 5432
```

## Step 4: Move Your Clients to the VPC Addresses

Switch your clients from the Private Network addresses to the VPC addresses, one service at a time,
and check that each service works before moving on. Depending on your setup, this can mean updating:

- DNS records
- Configuration files, connection strings and `/etc/hosts` entries.
- Service discovery registrations.

To roll back a service, point its clients back to the Private Network address.

## Step 5: Remove the Private Network

Once every client uses the VPC addresses, check that no traffic is left on the Private Network.
On each instance, find the Private Network interface with `ip address`, then watch its counters
for a while. Counters that no longer move mean the interface isn't used anymore.

Detach every instance from the Private Network, then delete it.

Finally, clean up the configuration that referenced the Private Network in your instances: static
interface configuration (netplan, cloud-init) for manual Private Networks, and host firewall rules
for the old range.

---

url: https://community.exoscale.com/product/networking/vpc/recipes/nat-gateway/

---

# Use an Instance as a NAT Gateway

This guide is provided for informational purposes. Because it involves third party tooling we cannot guarantee things still work exactly as described here.

In this recipe, an instance of your VPC acts as a NAT gateway for the other instances of its Subnet.
Traffic they send to an external network is routed to the gateway, which replaces their source
address with its own public IP before sending it on. External hosts only ever see the gateway's
public IP and can't open connections back to the instances behind it.

![](nat-gateway.drawio.png "NAT gateway setup")

The setup uses three instances:

- `internal-vm` is attached to the VPC Subnet and reaches the external network through the gateway.
- `gateway-vm` is attached to the VPC Subnet and translates the addresses.
- `external-vm` stands for the external network. It's not attached to the VPC. It can also be a
  machine outside of Exoscale, as long as `gateway-vm` can reach it.

The VPC side is configured with the `exo` CLI. Only the forwarding and address translation on the
gateway are configured inside the instance, with standard Linux tools.

## Before You Start

You need:

- The [Exoscale CLI](https://github.com/exoscale/cli/releases/latest), configured with `exo config`.
- An SSH key registered in your Exoscale account.

Set the following variables in your shell. The commands below refer to them:

```console
export ZONE=ch-dk-2
export SSH_KEY=your-ssh-key-in-exoscale
export SG=allow-ssh-from-any
export VPC_CIDR=10.1.0.0/24
```

## Step 1: Create the VPC and Subnet

```console
exo networking vpc create my-vpc -z $ZONE
exo networking vpc subnet create my-vpc my-subnet -z $ZONE \
    --ipv4-block $VPC_CIDR --address-family inet4 --address-space private
```

## Step 2: Create the Instances

Create a Security Group that allows SSH, then create `internal-vm` and `external-vm`:

```console
exo compute security-group create $SG
exo compute security-group rule add $SG \
    --flow ingress --protocol tcp --port 22 --network 0.0.0.0/0

exo compute instance create internal-vm \
    --ssh-key $SSH_KEY --security-group $SG -z $ZONE
exo compute instance create external-vm \
    --ssh-key $SSH_KEY --security-group $SG -z $ZONE
```

Create `gateway-vm` with VPC IP forwarding enabled

```console
exo compute instance create gateway-vm --ip-forwarding \
    --ssh-key $SSH_KEY --security-group $SG -z $ZONE
```

## Step 3: Attach the Instances to the Subnet

Attach `gateway-vm` and `internal-vm` to the Subnet. `external-vm` stays outside of the VPC and only
talks to the gateway over its public IP.

```console
$ exo compute instance attach-to-subnet gateway-vm my-vpc my-subnet -z $ZONE
$ exo compute instance attach-to-subnet internal-vm my-vpc my-subnet -z $ZONE
```

## Step 4: Allow the Traffic in Security Groups

The `$SG` Security Group only allows SSH. Add two more Security Groups:

- `internal-gateway-sg` allows all traffic between `gateway-vm` and `internal-vm` inside the VPC.
- `gateway-external-sg` allows all traffic between the public IPs of `gateway-vm` and
  `external-vm`.

Each one allows all traffic from the other members of the group:

```console
exo compute security-group create internal-gateway-sg
exo compute security-group rule add internal-gateway-sg \
    --flow ingress --protocol all --security-group internal-gateway-sg
exo compute instance security-group add gateway-vm internal-gateway-sg -z $ZONE
exo compute instance security-group add internal-vm internal-gateway-sg -z $ZONE

exo compute security-group create gateway-external-sg
exo compute security-group rule add gateway-external-sg \
    --flow ingress --protocol all --security-group gateway-external-sg
exo compute instance security-group add gateway-vm gateway-external-sg -z $ZONE
exo compute instance security-group add external-vm gateway-external-sg -z $ZONE
```

In production, narrow these rules down to the protocols and ports your workload needs.

## Step 5: Note the Addresses

Look up the public IP and the VPC address of each instance:

```console
exo compute instance show internal-vm -z $ZONE
exo compute instance show gateway-vm -z $ZONE
exo compute instance show external-vm -z $ZONE
```

Save them as variables:

```console
export GATEWAY_VPC_IP=<gateway-vm-vpc-ip>     # 10.1.0.20 in the diagram
export INTERNAL_VPC_IP=<internal-vm-vpc-ip>   # 10.1.0.10 in the diagram
export INT_PUB=<internal-vm-public-ip>
export GW_PUB=<gateway-vm-public-ip>
export EXT_PUB=<external-vm-public-ip>
export EXT_CIDR=$EXT_PUB/32   # the external range to reach through the gateway
```

> [!TIP]
> If you exported all the variables mentioned above you can connect to the VMs with
> `ssh ubuntu@$INT_PUB`, `ssh ubuntu@$GW_PUB` and `ssh ubuntu@$EXT_PUB` respectively.

## Step 6: Configure the VPC Network Interfaces

The new network interface (created in step 3) of each instance gets its address through DHCP.
Some operating systems may not configure this automatically. In that case, connect to `gateway-vm` and
`internal-vm` over SSH and start the DHCP client on the VPC interface yourself, for example on
Ubuntu 22.04:

```console
sudo dhclient eth1
```

## Step 7: Configure the Gateway Instance

Connect to `gateway-vm` with `ssh ubuntu@$GW_PUB`. Enable forwarding in the operating system, so
that the kernel routes packets between its interfaces, and keep the setting across reboots:

```console
# on gateway-vm
sudo sysctl -w net.ipv4.ip_forward=1
echo 'net.ipv4.ip_forward=1' | sudo tee /etc/sysctl.d/99-forwarding.conf
```

Find the public interface, usually `eth0`, then add a masquerading rule. Traffic from
`internal-vm` leaving through this interface gets the gateway's own address as its source:

```console
# on gateway-vm
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
```

This rule is lost when the instance reboots. Persist it with the mechanism of your operating
system, for example the `iptables-persistent` package on Ubuntu.

## Step 8: Route the Traffic Through the Gateway

Add a Subnet route that sends the traffic for the external network to `gateway-vm`. `$EXT_CIDR` is the
range you need to reach, here only `external-vm`:

```console
exo networking vpc route create my-vpc -z $ZONE \
    --subnet my-subnet \
    --destination $EXT_CIDR \
    --target ip=$GATEWAY_VPC_IP \
    --description "internal-vm to external network via gateway-vm"
```

The platform doesn't push this route to the instances of the Subnet. The operating system of
`internal-vm` still sends this traffic through its public interface, so add a matching route through
its VPC interface, with the same destination. The next hop is the Subnet gateway, the second address
of the Subnet (`10.1.0.1` here). The platform then applies the Subnet route and delivers the packets
to `gateway-vm`:

```console
# on internal-vm
sudo ip route add $EXT_CIDR via 10.1.0.1 dev eth1
```

This route is also lost when the instance reboots. Persist it in the network configuration of the
instance, for example with netplan on Ubuntu.

> [!WARNING]
> Be careful when the destination is broad, for example `0.0.0.0/0` to reach the whole internet.
> A default route through the VPC interface replaces the one through the public interface of
> `internal-vm`, and connections to its public IP, including your SSH session, stop working.

## Step 9: Test the Setup

From `internal-vm`, reach `external-vm`.

```console
ubuntu@internal-vm:~$ ping $EXT_PUB
```

If the ping gets no reply, check that:

- `gateway-vm` was created with `--ip-forwarding` and `net.ipv4.ip_forward` is `1`.
- The masquerading rule is present: `sudo iptables -t nat -L POSTROUTING -v -n`.
- `ip route get $EXT_PUB` on `internal-vm` shows `eth1` as the interface.
- `gateway-vm` can reach `external-vm` directly with `ping $EXT_PUB`.

---

url: https://community.exoscale.com/product/networking/vpc/recipes/wireguard-gateway/

---

# Connect a VPC to an External Network with WireGuard

This guide is provided for informational purposes. Because it involves third party tooling we cannot guarantee things still work exactly as described here.

In this recipe, an instance of your VPC acts as a router between its Subnet and an external network.
It connects to a host of the external network over a [WireGuard](https://www.wireguard.com/)
tunnel, which gives a routed link over the public internet. Traffic flows in both directions and
keeps its original source addresses: the external network can open connections to the instances of
the VPC, and sees their VPC addresses.

![](wireguard-gateway.drawio.png "WireGuard gateway setup")

The setup uses three instances:

- `internal-vm` is attached to the VPC Subnet.
- `gateway-vm` is attached to the VPC Subnet and routes traffic between the
  VPC and the tunnel.
- `external-vm` is the other end of the tunnel and stands for the external network. It's not
  attached to the VPC. It can also be a machine outside of Exoscale, for example a router in your
  office, as long as it can reach the public IP of `gateway-vm`.

The VPC side is configured with the `exo` CLI. The tunnel and the forwarding are configured inside
the instances.

> [!TIP]
> Of course this setup is also possible without a wireguard tunnel. The point is to connect two
> networks together and have each be able to reach the other.

## Before You Start

You need:

- The [Exoscale CLI](https://github.com/exoscale/cli/releases/latest), configured with `exo config`.
- An SSH key registered in your Exoscale account.

Set the following variables in your shell. The commands below refer to them:

```console
export ZONE=ch-dk-2
export SSH_KEY=your-ssh-key-in-exoscale
export SG=allow-ssh-from-any
export VPC_CIDR=10.1.0.0/24

export WG_CIDR=192.168.0.0/24
export WG_PORT=51820
export WG_GATEWAY_IP=192.168.0.1
export WG_EXTERNAL_IP=192.168.0.2
```

The tunnel addresses are arbitrary, but `$WG_CIDR` must not overlap with `$VPC_CIDR`.

## Step 1: Create the VPC and Subnet

```console
exo networking vpc create my-vpc -z $ZONE
exo networking vpc subnet create my-vpc my-subnet -z $ZONE \
    --ipv4-block $VPC_CIDR --address-family inet4 --address-space private
```

## Step 2: Create the Instances

Create a Security Group that allows SSH, then create `internal-vm` and `external-vm`:

```console
exo compute security-group create $SG
exo compute security-group rule add $SG \
    --flow ingress --protocol tcp --port 22 --network 0.0.0.0/0

exo compute instance create internal-vm \
    --ssh-key $SSH_KEY --security-group $SG -z $ZONE
exo compute instance create external-vm \
    --ssh-key $SSH_KEY --security-group $SG -z $ZONE
```

Create `gateway-vm` with VPC IP forwarding enabled. The gateway forwards packets from other hosts
with their original source address, and without this setting the platform drops them. It can only
be chosen when the instance is created:

```console
exo compute instance create gateway-vm --ip-forwarding \
    --ssh-key $SSH_KEY --security-group $SG -z $ZONE
```

## Step 3: Attach the Instances to the Subnet

Attach `gateway-vm` and `internal-vm` to the Subnet. `external-vm` stays outside of the VPC and only
talks to the gateway through the tunnel.

```console
exo compute instance attach-to-subnet gateway-vm my-vpc my-subnet -z $ZONE
exo compute instance attach-to-subnet internal-vm my-vpc my-subnet -z $ZONE
```

## Step 4: Allow the Traffic in Security Groups

**Traffic between `gateway-vm` and `internal-vm` inside the VPC.** Create a Security Group that
allows all traffic between its members:

```console
exo compute security-group create internal-gateway-sg
exo compute security-group rule add internal-gateway-sg \
    --flow ingress --protocol all --security-group internal-gateway-sg
exo compute instance security-group add gateway-vm internal-gateway-sg -z $ZONE
exo compute instance security-group add internal-vm internal-gateway-sg -z $ZONE
```

**The tunnel itself**, UDP port `$WG_PORT` between the public IPs of `gateway-vm` and
`external-vm`:

```console
exo compute security-group create wg-tunnel-sg
exo compute security-group rule add wg-tunnel-sg \
    --flow ingress --protocol udp --port $WG_PORT --security-group wg-tunnel-sg
exo compute instance security-group add gateway-vm wg-tunnel-sg -z $ZONE
exo compute instance security-group add external-vm wg-tunnel-sg -z $ZONE
```

If `external-vm` is outside of Exoscale, it can't join the Security Group. Allow its public IP
with `--network <external-public-ip>/32` instead, and open the port in its own firewall.

**Traffic arriving through the tunnel.** Packets from `external-vm` reach `internal-vm` with a
source address in `$WG_CIDR`, not from a member of `internal-gateway-sg`, so the rules above don't
match them:

```console
exo compute security-group rule add internal-gateway-sg \
    --flow ingress --protocol all --network $WG_CIDR
```

In production, narrow these rules down to the protocols and ports your workload needs.

## Step 5: Note the Addresses

Look up the public IP and the VPC address of each instance:

```console
exo compute instance show internal-vm -z $ZONE
exo compute instance show gateway-vm -z $ZONE
exo compute instance show external-vm -z $ZONE
```

Save them as variables:

```console
export GATEWAY_VPC_IP=<gateway-vm-vpc-ip>     # 10.1.0.20 in the diagram
export INTERNAL_VPC_IP=<internal-vm-vpc-ip>   # 10.1.0.10 in the diagram
export INT_PUB=<internal-vm-public-ip>
export GW_PUB=<gateway-vm-public-ip>
export EXT_PUB=<external-vm-public-ip>
```

> [!TIP]
> If you exported all the variables mentioned above you can connect to the VMs with
> `ssh ubuntu@$INT_PUB`, `ssh ubuntu@$GW_PUB` and `ssh ubuntu@$EXT_PUB` respectively.

## Step 6: Configure the VPC Network Interfaces

The new network interface (created in step 3) of each instance gets its address through DHCP.
Some operating systems may not configure this automatically. In that case, connect to `gateway-vm` and
`internal-vm` over SSH and start the DHCP client on the VPC interface yourself, for example on
Ubuntu 22.04:

```console
sudo dhclient eth1
```

## Step 7: Install WireGuard and Generate Keys

On both `gateway-vm` and `external-vm`, install WireGuard and generate a key pair:

```console
sudo apt-get update && sudo apt-get install -y wireguard
wg genkey | sudo tee /etc/wireguard/private.key | wg pubkey | sudo tee /etc/wireguard/public.key
sudo chmod 600 /etc/wireguard/private.key
```

Print the public key of each side and note it down. Each side's configuration needs the public key
of the other:

```console
sudo cat /etc/wireguard/public.key
```

## Step 8: Configure the Gateway Side

On `gateway-vm`, enable forwarding in the operating system and keep the setting across reboots:

```console
# on gateway-vm
sudo sysctl -w net.ipv4.ip_forward=1
echo 'net.ipv4.ip_forward=1' | sudo tee /etc/sysctl.d/99-forwarding.conf
```

Create `/etc/wireguard/wg0.conf`. The addresses and the port match `$WG_GATEWAY_IP`,
`$WG_EXTERNAL_IP` and `$WG_PORT`:

```ini
[Interface]
Address = 192.168.0.1/24
ListenPort = 51820
PrivateKey = <gateway-vm-private-key>

[Peer]
# external-vm
PublicKey = <external-vm-public-key>
Endpoint = <external-vm-public-ip>:51820
AllowedIPs = 192.168.0.2/32
```

`AllowedIPs` acts as the routing table of WireGuard. It adds a route to `192.168.0.2/32` through
`wg0`, and only accepts packets from the peer whose source address is in this list. If more
networks sit behind `external-vm`, add their ranges here.

The gateway must forward packets between the VPC interface (`eth1`) and the tunnel:

```console
# on gateway-vm
sudo iptables -A FORWARD -i eth1 -o wg0 -j ACCEPT
sudo iptables -A FORWARD -i wg0 -o eth1 -j ACCEPT
```

These rules are lost when the instance reboots. Persist them with the mechanism of your operating
system, for example the `iptables-persistent` package on Ubuntu.

## Step 9: Configure the External Side

On `external-vm`, create `/etc/wireguard/wg0.conf`:

```ini
[Interface]
Address = 192.168.0.2/24
ListenPort = 51820
PrivateKey = <external-vm-private-key>

[Peer]
# gateway-vm, and the VPC Subnet behind it
PublicKey = <gateway-vm-public-key>
Endpoint = <gateway-vm-public-ip>:51820
AllowedIPs = 192.168.0.1/32, 10.1.0.0/24
```

The `10.1.0.0/24` entry (`$VPC_CIDR`) makes `internal-vm` reachable from `external-vm`. It adds a
route to the VPC Subnet through `wg0`, and accepts packets with a source address in the Subnet.

## Step 10: Bring the Tunnel Up

On both `gateway-vm` and `external-vm`, start the tunnel and enable it at boot:

```console
sudo systemctl enable --now wg-quick@wg0
```

Check that a handshake happened and that the transfer counters aren't zero, then check the routes:

```console
sudo wg show
ip route show dev wg0
```

From `gateway-vm`, `ping $WG_EXTERNAL_IP` now gets replies.

## Step 11: Route the Tunnel Network Through the Gateway

Add a Subnet route that sends the traffic for the tunnel network to `gateway-vm`:

```console
exo networking vpc route create my-vpc -z $ZONE \
    --subnet my-subnet \
    --destination $WG_CIDR \
    --target ip=$GATEWAY_VPC_IP \
    --description "tunnel network via gateway-vm"
```

The platform doesn't push this route to the instances of the Subnet. The operating system of
`internal-vm` still sends this traffic through its public interface, so add a matching route through
its VPC interface, with the same destination. The next hop is the Subnet gateway, the second address
of the Subnet (`10.1.0.1` here). The platform then applies the Subnet route and delivers the packets
to `gateway-vm`:

```console
# on internal-vm
sudo ip route add $WG_CIDR via 10.1.0.1 dev eth1
```

This route is lost when the instance reboots. Persist it in the network configuration of the
instance, for example with netplan on Ubuntu.

Both directions need this route: `internal-vm` uses it to send traffic to `external-vm`, and to
reply to connections opened by `external-vm`.

## Step 12: Test Both Directions

From `internal-vm` you can reach `external-vm`:

```console
ubuntu@internal-vm:~$ ping $WG_EXTERNAL_IP
```

From `external-vm` you can reach `internal-vm`:

```console
ubuntu@external-vm:~$ ping $INTERNAL_VPC_IP
```

If the traffic doesn't get through, check that:

- `gateway-vm` was created with `--ip-forwarding` and `net.ipv4.ip_forward` is `1`.
- `sudo wg show` reports a recent handshake on both sides.
- `ip route get $WG_EXTERNAL_IP` on `internal-vm` shows `eth1` as the interface.
- The `AllowedIPs` of each side list every address the other side sends from.
