---
title: "Network interfaces"
description: "Network interfaces, each with its own public IPv6 /64 or, in a VPC, private addresses; primary and secondary interfaces, firewalls, and moving an interface between instances."
---

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

# Network interfaces

A network interface connects an instance to the internet. **Each interface has its own public IPv6
/64**, routed to it, and can have one public [IPv4 address](/compute/ipv4-addresses). Its
[firewalls](/compute/firewalls) decide what reaches it. A **private** interface, created in a
[VPC subnet](/private-networks/vpcs#private-network-interfaces), has private addresses instead and no public
ones, unless its VPC has a [Network Gateway](/private-networks/network-gateways). In the console,
open **Private Networks**, then **Network interfaces**, or an instance's
**Networking** tab.

| Field | Meaning |
| --- | --- |
| `ipv6Prefix` | The interface's /64. Fixed for the interface's life. `null` on a private interface without a public IPv6 prefix |
| `ipv6Address` | `<prefix>::1`, the address cloud-init configures and the instance's traffic leaves from. On a private interface, its primary private IPv6 address |
| `publicIpv6Address` | `<prefix>::1` when it has a `/64`, else `null` |
| `ipv4Address` | Its public IPv4 address, or `null`. On a private interface, mapped to its private address; the instance never sees it |
| `macAddress`, `mtu` | Fixed for the interface's life; the MTU is 1500, or 8900 on a private interface |
| `vpc`, `subnet`, `privateIpv4Address` | A private interface's VPC, subnet and primary private IPv4 address; `null` on a public interface |
| `secondaryPrivateIpv4Addresses`, `secondaryPrivateIpv6Addresses` | A private interface's [secondary addresses](/private-networks/vpcs#secondary-private-addresses); empty on a public interface |
| `privateAddressAssignments` | Each private address it owns, `{ family, address, primary, generation }`; empty on a public interface |
| `privatePrefixAssignments` | Each [delegated prefix](/private-networks/vpcs#delegated-prefixes) it owns, `{ family, prefix, generation }`; empty on a public interface |
| `attachment` | The instance it's attached to, its `deviceIndex`, whether it's the `primary`, and `deleteOnTermination` |
| `sourceDestCheck` | `true`: the interface accepts only traffic addressed to it and sends only traffic from its own addresses |
| `status` | `creating`, `available` (not attached), `attached` or `deleting` |

## Primary and secondary interfaces

Every instance has one **primary** interface, device index 0, which carries the default routes. A
launch creates it, or uses an available interface you name. Instances can have more interfaces, up
to their [instance type's](/compute/instance-types) `limits.networkInterfaces`.

- An interface the launch created is deleted when the instance terminates; one you named is
  detached and kept.
- The primary interface can't be detached (`409 primary_interface`).
- Interfaces are attached and detached while the instance is stopped
  ([AttachNetworkInterface](/compute/instances#attach-and-detach)). The guest configures them at
  its next start.
- **Moving an interface** is a detach and an attach. Its /64, MAC address and IPv4 address go with
  it, or a private interface's addresses. The instance and interface must be in the same project.
- A private interface is an instance's primary only when the instance is launched with it
  ([private primary](/private-networks/network-gateways#instances-with-a-private-primary)); such an
  instance has no public interface.

## Create an interface

In the console, choose **Create network interface**; with the API, call
[CreateNetworkInterface](/network-api/CreateNetworkInterface/). It answers `201` with the
interface, with its /64 allocated if it has one.

| Setting | Console | API | |
| --- | --- | --- | --- |
| Name, description | **Name**, **Description** | `name`, `description` | Name 1–128 characters; description up to 500 |
| Public IPv4 | **Public IPv4 address** | `ipv4: { allocate: true }`, or `{ address: "pip_…" }` for one you have | Optional. With `subnet`, `{ allocate: true \| false }` only; omitted, the subnet's auto-assign decides |
| Public IPv6 | | `ipv6: { allocate: true \| false }` | With `subnet` only: a public `/64` ([Network Gateways](/private-networks/network-gateways#public-ipv6-on-a-private-interface)); omitted, the subnet's auto-assign decides |
| Network | **Network**: **Public**, or a subnet | `subnet: "sbn_…"`, and optionally `privateIpv4Address` | Optional: makes a [private interface](/private-networks/vpcs#private-network-interfaces) |
| Firewalls | **The project's default**, or **Choose firewalls** | `firewalls` | Up to 5. Omitted: the project's default firewall, or a private interface's VPC's default firewall; `[]`: none |

An interface with no firewalls gets no inbound traffic. From the CLI:

```sh
ezgh compute network-interfaces create web --allocate-ipv4
ezgh compute network-interfaces create db --firewall db --firewall ssh
ezgh compute network-interfaces create db-private --subnet app --private-ipv4 10.0.1.20
```

## Firewalls

The interface's **Firewalls** tab lists its firewalls and whether their rules are **Applied** or
still **Applying**. **Edit firewalls** sets them, at most 5. With the API,
[SetInterfaceFirewalls](/firewall-api/SetInterfaceFirewalls/) replaces the set, and
[GetInterfaceEffectiveRules](/firewall-api/GetInterfaceEffectiveRules/) shows the rules in
force; from the CLI, `ezgh compute network-interfaces firewalls get|set <interface>` and
`ezgh compute network-interfaces effective-rules <interface>`. See [Firewalls](/compute/firewalls).

## Delete an interface

An attached interface can't be deleted (`409 interface_in_use`). Deleting one
([DeleteNetworkInterface](/network-api/DeleteNetworkInterface/), `ezgh compute network-interfaces delete`) gives up its /64. Its IPv4
address is released if it was allocated with the interface (`autoRelease`), and otherwise only
disassociated, so you keep it.

Source: https://docs.ezghcloud.com/private-networks/network-interfaces/index.mdx
