Create VMs with multiple network interfaces


By default, every compute instance has at least one network interface (vNIC)that determines the Virtual Private Cloud network that the instance uses. You cancreate an instance with multiple network interfaces. Except forVPC networks that are created with an RDMA network profile, eachnetwork interface must be assigned to a subnet in a unique VPCnetwork. The stack type of the network interface and the stack type of thesubnet work together as described inStack types and IP addresses

Each compute instance receives a default route using DHCP Option 121, as definedbyRFC 3442. The default routeis associated withnic0. Unless manually configured otherwise, any trafficleaving an instance for any destination other than a directly connected subnetleaves the instance using the default route onnic0.

On Linux systems, you can configure custom rules and routes within the guest OSusing the/etc/iproute2/rt_tables file and theip rule andip routecommands. For more information, consult the guest OS documentation. For anexample, see the tutorialConfigure routing for an additional interface.

If you don't require multiple network interfaces, follow the procedure forcreating and starting an instanceto create instances with the default network configuration.

Before you begin

Required roles

To get the permissions that you need to create an instance with a specific subnet, ask your administrator to grant you theCompute Instance Admin (v1) (roles/compute.instanceAdmin.v1) IAM role on the project. For more information about granting roles, seeManage access to projects, folders, and organizations.

This predefined role contains the permissions required to create an instance with a specific subnet. To see the exact permissions that are required, expand theRequired permissions section:

Required permissions

The following permissions are required to create an instance with a specific subnet:

  • compute.instances.create on the project
  • To specify a subnet for your instance: compute.subnetworks.use on the project or on the chosen subnet
  • To assign an external IP address to the instance when using a VPC network: compute.subnetworks.useExternalIp on the project or on the chosen subnet

You might also be able to get these permissions withcustom roles or otherpredefined roles.

Requirements

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

  • Except for VPC networks that are created with anRDMA network profile, the followinglimitation applies: If you create an instance with multiple networkinterfaces, each interface must connect to a different VPCnetwork. The networks can be standaloneVPC networks orShared VPC networks.
  • Each network interface must use a unique subnet IP address range.
  • For multi-NIC compute instances in standalone projects, each networkinterface must use a subnet located in the same project as the instance. Forinstances in Shared VPC host or service projects, seeShared VPCin the Virtual Private Cloud documentation.Private Service Connect interfacesprovide a way for a multi-NIC instance to have network interfaces in subnetsin different projects. For more information, seeAbout network attachments.

Create VM instances with multiple network interfaces

Most Compute Engine instances let you configure multiple vNICs whencreating the instance.

For information about how to create a compute instance with multiple networkinterfaces, seeCreate VM instances with multiple network interfaces.

Add network interfaces to an existing instance

You can configure virtual NICs (vNICs) for an instance only when creating theinstance. However, you can add or removeDynamic NICsto 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 specifya VLAN ID that is used to tag network traffic for theDynamic 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 parentvNIC. However, Dynamic NICs that belong todifferent parent vNICs can use the same VLAN ID.

Google Cloud uses the following format for the name of aDynamic NIC:PARENT_NIC_NUMBER.VLAN_ID

PARENT_NIC_NUMBER is the name of the parent vNIC, for examplenic0. TheVLAN_ID is the number you specified whenconfiguring the Dynamic NIC. An exampleDynamic NIC name isnic0.4.

For information about how to add Dynamic NICs to aninstance, seeAdd Dynamic NICs to an instance.

What's next?

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-11 UTC.