By default, every compute instance has at least one network interface (vNIC)
that determines the Virtual Private Cloud network that the instance uses. You can
create an instance with multiple network interfaces. For an overview of multiple
network interfaces in Google Cloud, see
[Multiple network interfaces](https://docs.cloud.google.com/vpc/docs/multiple-interfaces-concepts.md.txt).

Each compute instance receives a default route using DHCP Option 121, as defined
by [RFC 3442](https://datatracker.ietf.org/doc/html/rfc3442). The default route
is associated with `nic0`. Unless manually configured otherwise, any traffic
leaving an instance for any destination other than a directly connected subnet
leaves the instance using the default route on `nic0`.

On Linux systems, you can configure custom rules and routes within the guest OS
using the `/etc/iproute2/rt_tables` file and the `ip rule` and `ip route`
commands. For more information, consult the guest OS documentation. For an
example, see the tutorial
[Configure routing for an additional interface](https://docs.cloud.google.com/vpc/docs/configure-routing-additional-interface.md.txt).

If you don't require multiple network interfaces, follow the procedure for
[creating and starting an instance](https://docs.cloud.google.com/compute/docs/instances/create-start-instance.md.txt)
to create instances with the default network configuration.

To create an instance that uses Cloud RDMA network
interfaces, see instead
[Create an instance that uses Cloud RDMA](https://docs.cloud.google.com/compute/docs/instances/create-vm-with-rdma.md.txt).

## Requirements

Before you create an instance with multiple network interfaces, review the
following requirements:

- Each network interface must use a unique subnet. Multiple network interfaces of an instance can use subnets in different VPC networks or in the same VPC network as described in [Network and subnet requirements](https://docs.cloud.google.com/vpc/docs/multiple-interfaces-concepts.md.txt#specifications).
- For multi-NIC compute instances in standalone projects, each network interface must use a subnet located in the same project as the instance. For instances in Shared VPC host or service projects, see [Shared VPC](https://docs.cloud.google.com/vpc/docs/multiple-interfaces-concepts.md.txt#multiple-network-interfaces-in-shared-vpc) in the Virtual Private Cloud documentation. [Private Service Connect interfaces](https://docs.cloud.google.com/vpc/docs/about-private-service-connect-interfaces.md.txt) provide a way for a multi-NIC instance to have network interfaces in subnets in different projects. For more information, see [About network attachments](https://docs.cloud.google.com/vpc/docs/about-network-attachments.md.txt).

## Create VM and bare metal instances with multiple network interfaces

Most Compute Engine VM instances and some bare metal instances let you
configure multiple network interfaces when creating the instance.

- For information about the number of network interfaces you can create for an instance, see [Maximum number of network interfaces](https://docs.cloud.google.com/vpc/docs/multiple-interfaces-concepts.md.txt#max-interfaces).
- ([Preview](https://cloud.google.com/products#product-launch-stages)): For C4D bare metal instances, multiple network interfaces are exposed using Single Root I/O Virtualization (SR-IOV) Virtual Functions (VFs) over the Intel IDPF driver, providing up to 10 distinct interfaces mapped to separate VPC networks.
- You can also configure [Dynamic NICs](https://docs.cloud.google.com/vpc/docs/multiple-interfaces-concepts.md.txt#nic-types) when creating an instance.

You can create a VM instance with up to 10 network interfaces. For some machine
series, the number of IDPF network interfaces that you can
configure for a bare metal instance depends on the machine series, as
explained in the following table:

| Machine series | Network interface types | Number to configure |
|---|---|---|
| C4D (bare metal) ([Preview](https://cloud.google.com/products#product-launch-stages)) | IDPF only | 1 to 10 |
| Z4D or Z4M (bare metal) | IDPF only | 1 or 2 |
| Z4M (bare metal) | IDPF and IRDMA | 1 IDPF and 1 IRDMA or 2 IDPF and 1 or 2 IRDMA |
| All other machine series | IDPF only | 1 |

For the instructions to create a compute instance with multiple network
interfaces, see
[Create compute instances with multiple network interfaces](https://docs.cloud.google.com/vpc/docs/create-use-multiple-interfaces.md.txt#creating_virtual_machine_instances_with_multiple_network_interfaces)
in the VPC documentation.

## Add network interfaces to an existing instance

You can configure virtual NICs (vNICs) for an instance only when creating the
instance. However, you can add or remove
[Dynamic NICs](https://docs.cloud.google.com/vpc/docs/multiple-interfaces-concepts.md.txt#nic-types)
to an existing instance, and you don't have to restart the instance.

Dynamic NICs are subinterfaces of a parent vNIC.
When you configure a Dynamic NIC, you specify
a VLAN ID that is used to tag network traffic for the
Dynamic NIC:

- The VLAN ID of a Dynamic NIC must be an integer from 2 to 255.
- The VLAN ID of a Dynamic NIC must be unique within a parent vNIC. However, Dynamic NICs that belong to different parent vNICs can use the same VLAN ID.

Google Cloud uses the following format for the name of a
Dynamic NIC:
`PARENT_NIC_NUMBER.VLAN_ID`

`PARENT_NIC_NUMBER` is the name of the parent vNIC, for example
`nic0`. The `VLAN_ID` is the number you specified when
configuring the Dynamic NIC. An example
Dynamic NIC name is `nic0.4`.

For information about how to add Dynamic NICs to an
instance, see
[Add Dynamic NICs to an instance](https://docs.cloud.google.com/vpc/docs/add-dynamic-nics.md.txt).

## What's next?

- Learn how to use [SSH connections](https://docs.cloud.google.com/compute/docs/instances/ssh.md.txt) to connect to your instance.
- [Access VMs using internal DNS](https://docs.cloud.google.com/compute/docs/networking/using-internal-dns.md.txt)
- [Create a PTR record for a VM instance](https://docs.cloud.google.com/compute/docs/instances/create-ptr-record.md.txt)