Google Virtual NIC (gVNIC) is a virtual network interface designed specifically for Compute Engine. gVNIC is an alternative to the virtIO-based ethernet driver.
As the next generation network interface which succeeds VirtIO, gVNIC replaces VirtIO-Net as the only supported network interface in Compute Engine for all new machine types (Generation 3 and onwards). Newer machine series and networking features require gVNIC instead of VirtIO. Consuming gVNIC as the modern I/O interface with Compute Engine VMs allows us to:
- Provide better performance.
- Improve consistency by reducing noisy neighbor problems.
- Introduce new network functionality beyond what VirtIO is capable of.
gVNIC is supported and recommended on all machine families, machine types, and generations.
gVNIC is required to support:
- 50 to 200 Gbps bandwidth with VMs that support per VM Tier_1 networking performance.
- 50 to 100 Gbps bandwidths with VMs that have attached GPUs, which helps improve the performance of distributed workloads.
- Confidential VMs, third generation machine series VMs, and VMs that run on the Arm CPU platform.
Before you begin
- If you use gVNIC with Windows Server 2022 or Windows 11 VMs, update the
gVNIC driver to GooGet package version
1.0.0@45
or later to improve networking throughput. For more information, see known issues. -
Set up authentication.
Select the tab for how you plan to use the samples on this page:
gcloud
-
Install the Google Cloud CLI, then initialize it by running the following command:
gcloud init
- 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.
Install the Google Cloud CLI, then initialize it by running the following command:
gcloud init
-
Pricing
To see the latest prices for Tier_1 networking, refer to the VM instance pricing page.
For a list of additional methods that can be used to find pricing information, see Compute Engine pricing.
Operating system support
On Compute Engine, you can choose to use gVNIC on any supported public images. You can manually install the gVNIC driver on:
- Non-supported operating systems
- Operating systems that do not have the latest gVNIC driver version
For the supported operating systems, see the Supported interfaces tab for an operating system. Also check the Networking features tab for networking feature support.
Use on non-supported operating systems
For images that support gVNIC but don't include the latest version of the gVNIC driver, you can download the latest driver version from GitHub.
You can manually configure and install the latest version of the gVNIC driver on either Linux or Windows VMs.
After you update the operating system in your VM to use gVNIC, create a custom image based on that OS image. You can then use the custom image to create additional VMs that use gVNIC on that operating system. For more information about creating VMs using a custom image, see Create a custom image that supports gVNIC on this page.
Use the following procedures to manually configure and install the latest version of the gVNIC driver:
- For Linux VMs, see Linux kernel driver Compute Engine Virtual Ethernet.
- For Windows VMs, see Windows driver for Compute Engine Virtual Ethernet.
Limitations
- Large receive offload (LRO) is currently not supported. Generic receive offload (GRO) is enabled by default for VMs that use gVNIC.
- Large service offload version 2 (LSOV2)
is not supported on Windows 11 or Windows Server 2022 VMs. gVNIC driver
versions
1.0.0@45
and later disable LSOV2. To learn how to check and update your VM's gVNIC driver on Microsoft Windows, see known issues.
Overview of using gVNIC with Compute Engine VMs
To create a VM that uses gVNIC, complete the following steps:
- Choose a public image that supports gVNIC, or create a custom image that is tagged to use gVNIC.
- Create a VM using the public or custom image. During the VM creation, configure the network interface to use gVNIC.
- Verify that gVNIC is enabled.
If you encounter any issues, see Troubleshooting Google Virtual NIC.
Create a custom image that supports gVNIC
You can create the image using either the Google Cloud CLI or REST. For detailed information and best practices for creating custom images, see Create custom images.
gcloud
Select an image or image family that supports gVNIC. For more information, see Operating system details.
Using the image or image family selected in the previous step, create a custom image and tag this image with
GVNIC
. To create the custom image, use thegcloud compute images create
command. For example, the following command creates a custom image that supports gVNIC and that's based on a specific OS image.gcloud compute images create IMAGE_NAME \ --source-image=SOURCE_IMAGE \ --source-image-project=SOURCE_IMAGE_PROJECT \ --guest-os-features=GVNIC
Replace the following:
IMAGE_NAME
: the name of the image that you want to create.SOURCE_IMAGE
: a specific image that supports gVNIC–for example:rocky-linux-8-optimized-gcp-v20220719
.If you want to use the latest image in an image family, replace the
--source-image
flag with the--source-image-family
flag and set its value to an image family that supports gVNIC. For example:--source-image-family=rocky-linux-8-optimized-gcp
.SOURCE_IMAGE_PROJECT
: the name of the project that contains the source image or image family.
Example
To create a Rocky Linux 8 Optimized for Google Cloud image using the latest image from the Compute Engine
rocky-linux-8-optimized-gcp
image family, run the following command:gcloud compute images create IMAGE_NAME \ --source-image-family=rocky-linux-8-optimized-gcp \ --source-image-project=rocky-linux-cloud \ --guest-os-features=GVNIC
For more information about when to use image families, see Image family best practices.
REST
Select an image or image family that supports gVNIC For more information, see Operating system details.
Using the image or image family selected in the previous step, create an image and tag this image with
GVNIC
. To create the image, use theimages.insert
method.POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/global/images { "name":"IMAGE_NAME", "sourceImage":"SOURCE_IMAGE_URI", "guestOsFeatures":[ { "type":"GVNIC" } ] }
Replace the following:
IMAGE_NAME
: the name of the image that you want to create.SOURCE_IMAGE_URI
: the URI for the specific image or image family that you want to use.For example:
- Specific image:
"sourceImage": "projects/rocky-linux-cloud/global/images/rocky-linux-8-optimized-gcp-v20220719"
- Image family:
"sourceImage": "projects/rocky-linux-cloud/global/images/family/rocky-linux-8-optimized-gcp"
.
When you specify an image family, Compute Engine creates a VM from the most recent, non-deprecated OS image in that family. For more information about when to use image families, see Image family best practices.
- Specific image:
Create a VM with gVNIC support
You can create a VM using one of the supported public images or using a custom image you created using the steps in Create a custom image that supports gVNIC.
Optionally, you can enable DPDK on the VM for faster network packet processing, low latency, and consistent performance.
Create a VM using a public image
To create a VM using a public image that supports gVNIC, follow the instructions at Creating VMs and containers with high-bandwidth configuration.
Create a VM using a custom image
If you aren't using a public image that supports gVNIC, you must first create a custom image that supports gVNIC. You then use that custom image to create a VM by using the Google Cloud CLI or REST.
gcloud
Create the VM by using the
gcloud compute instances create
command. For the boot disk, specify the custom image that you created earlier. For the network interface, set the value of thenic-type
flag toGVNIC
.gcloud compute instances create VM_NAME \ --zone=ZONE \ --image=IMAGE_NAME \ --image-project=YOUR_IMAGE_PROJECT \ --network-interface=nic-type=GVNIC
Replace the following:
VM_NAME
: the name of the new VM.ZONE
: the zone to create the VM in.IMAGE_NAME
: the image that was created in the previous step.YOUR_IMAGE_PROJECT
: the name of your project that contains the image.
Example
To create a Rocky Linux 8 VM in zone
us-west1-b
using an image namedmy-gvnic-rocky8
that's in projectmy-project-12345
, run the following command:gcloud compute instances create my-rocky-linux-vm \ --zone=us-west1-b \ --image=my-gvnic-rocky8 \ --image-project=my-project-12345 \ --network-interface=nic-type=GVNIC
Things to consider
The
--network-interface
flag has sub-level flags such as the following:--address
: Assign an IP address to the VM--network
: The network the interface will be a part of--network-tier
: The network tier of the interface--subnet
: The subnet that the interface will be part of. If--network
is also specified, the subnet must be a part of the specified network.--private-network-ip
: Specify the RFC 1918 IP to assign to the VM.
For a full list see, the
--network-interface
flag.Verify that Compute Engine created the VM and that the
nicType
is set toGVNIC
.gcloud compute instances describe VM_NAME \ --zone=ZONE
Replace the following:
VM_NAME
: the name of the VM.ZONE
: the zone that you created the VM in.
REST
Create the VM by using the
instances.insert
method.
- For the boot disk, specify the custom image that you created earlier.
- For the network interface, set the value of the
nicType
field toGVNIC
.
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances { "name":"VM_NAME", "networkInterfaces":[ { "network":"NETWORK", "nicType":"GVNIC", "subnet":"SUBNET_NAME" } ], "disks":[ { "initializeParams":{ "sourceImage":"projects/YOUR_IMAGE_PROJECT/global/images/IMAGE_NAME" }, "boot":true } ] }
Replace the following:
PROJECT_ID
: the ID of the project to create the VM in.ZONE
: the zone to create the VM in.VM_NAME
: the name of the new VM.NETWORK
: the URL of the network resource for this VM. If neither the network nor the subnetwork is specified, the default networkglobal/networks/default
is used.SUBNET_NAME
: name of the subnet. The network is inferred from the specified subnet. This is an optional field.YOUR_IMAGE_PROJECT
: the name of your project that contains the image.IMAGE_NAME
: the image that was created in the previous step.
Verify that gVNIC is enabled
Linux
On your Linux VM instance, run the following commands:
sudo lshw -class network
The output resembles the following:
*-network description: Ethernet interface product: Compute Engine Virtual Ethernet [gVNIC] vendor: Google, Inc. physical id: 4 bus info: pci@0000:00:04.0 logical name: eth0 version: 00 serial: 42:01:0a:8a:00:04 width: 32 bits clock: 33MHz capabilities: msix bus_master cap_list ethernet physical configuration: broadcast=yes driver=gve driverversion=1.0.0 ip=10.138.0.4 latency=0 link=yes multicast=yes resources: irq:11 memory:c0102000-c0102fff memory:c0101000-c010103f memory:c0000000-c00fffff
Windows
- On your Windows VM Instance, open the Device Manager.
- Under Network Adapters, you should see:
"Google Ethernet Adapter"
Troubleshooting
To troubleshoot gVNIC, see Troubleshooting Google Virtual NIC.
What's next
- Connect to your instance.
- Add persistent disks to your new instance.
- Configure per VM Tier_1 networking performance.
- Change the MTU setting of a VPC network.
- Learn about jumbo frames.