Every Compute Engine instance has a nic0
virtual network interface (vNIC)
connected to a subnet in a VPC network. Depending on the
instance's machine type, you can define additional vNICs only when you create a
instance.
With Dynamic Network Interfaces (Preview), you can create VLAN-based subinterfaces for each vNIC, which lets you scale the number of network interfaces and VPC network connections.
You can add or remove Dynamic NICs without having to restart or recreate the instance. For more information, see the following pages in the Virtual Private Cloud (VPC) documentation:
This page describes how to update the properties of the network interface of an instance.
Before you begin
-
If you haven't already, then set up authentication.
Authentication is
the process by which your identity is verified for access to Google Cloud services and APIs.
To run code or samples from a local development environment, you can authenticate to
Compute Engine by selecting one of the following options:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloud
-
After installing the Google Cloud CLI, initialize it by running the following command:
gcloud init
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
- Set a default region and zone.
REST
To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.
After installing the Google Cloud CLI, initialize it by running the following command:
gcloud init
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
For more information, see Authenticate for using REST in the Google Cloud authentication documentation.
-
Update a network interface of an instance
To update the properties of a network interface, see the procedure that corresponds to the property that you want to update, such as one of the following.
If you are updating a Dynamic NIC
(Preview), you must use the
gcloud beta compute instances network-interfaces update
command
or the beta version of the
instances.updateNetworkInterface
method.
Additionally, ensure that you specify Dynamic NICs according to
the naming format of Dynamic NICs.
- To update the network or subnetwork that the network interface belongs to, see Migrating a VM between networks.
- To update the IP stack type, see Change the stack type of an instance.
- To update IP addresses, see the following:
- To update alias IP ranges, see Modify alias IP ranges for an existing instance.
- To update network edge security policies, see Configure network edge security policies.
What's next
- Learn how to create and manage routes for VPC networks.
- Learn how to scale your VMs and optimize application latency with load balancing.