The Compute Engine virtual network interface (also known as gVNIC) is specifically designed for use on Compute Engine. Compute Engine virtual network interface provides a more efficient delivery network for sending traffic to and from your VM instances. Previously, virtual machine (VM) instances that run on Compute Engine use a virtual network interface based on the virtIO specification.
The Compute Engine virtual network interface is required to support higher network bandwidths such as the 50-100 Gbps speeds that can be used for distributed workloads on instances that have attached GPUs.
To create VM instances that use the Compute Engine virtual network interface, you can complete one of the following steps:
- Create your VM instances using an image from
the
gvnic-vm-image-prod
image family. - Manually install the Compute Engine virtual network driver on any Linux image of your choice and then use the image to create a VM instance.
Before you begin
- If you want to use the command-line examples in this guide:
- Install or update to the latest version of the gcloud command-line tool.
- Set a default region and zone.
- If you want to use the API examples in this guide, set up API access.
Limitations
The Compute Engine virtual network interface is not supported on VM instances that use memory-optimized machine types.
Operating system support
The following images belong to the gvnic-vm-image-prod
image project and are
configured to use the Compute Engine virtual network interface:
- Debian 9 -
debian-9-gvnic
- Windows
- Windows Server 2019 -
windows-2019-gvnic
- Windows Server 2016 -
windows-2016-gvnic
- Windows Server 2012 R2 -
windows-2012-r2-gvnic
- Windows Server 2008 R2 -
windows-2008-r2-gvnic
- Windows Server 2019 -
You can use any of these images to create a VM instance that, by default, uses the Compute Engine virtual network interface.
Creating a VM instance using pre-configured images
To create a VM instance using an image from the
gvnic-vm-image-prod
image project, follow the steps to
create a VM instance and
provide the image project and image family.
Debian
To create a Debian instance, run the following command:
gcloud beta compute instances create instance-name \ --image-project=gvnic-vm-image-prod \ --image-family=debian-9-gvnic
Replace instance-name
with the name of your instance.
Windows
To create a Windows 2019 instance, run the following command:
gcloud beta compute instances create instance-name \ --image-project=gvnic-vm-image-prod \ --image-family=windows-2019-gvnic
To create a Windows 2016 instance, run the following command:
gcloud beta compute instances create instance-name \ --image-project=gvnic-vm-image-prod \ --image-family=windows-2016-gvnic
To create a Windows 2012-r2 instance, run the following command:
gcloud beta compute instances create instance-name \ --image-project=gvnic-vm-image-prod \ --image-family=windows-2012-r2-gvnic
To create a Windows 2008-r2 instance, run the following command:
gcloud beta compute instances create instance-name \ --image-project=gvnic-vm-image-prod \ --image-family=windows-2008-r2-gvnic
Replace
instance-name
with the name of your instance.
Manually installing the Compute Engine virtual network driver
To create a VM instance from an image that does not have the Compute Engine virtual network driver installed, you need to:
- Install the Compute Engine virtual network driver on the image.
- Use the image, that now has the Compute Engine virtual network driver installed, to create a VM instance.
Linux
Before you can install the Compute Engine virtual network driver, you must install the latest versions of the kernel driver and header for your operating system. An instance that uses a Compute Engine virtual network interface without a kernel driver will not have internal or external network connectivity, including SSH and RDP.
To build and install the kernel driver from source you must have a supported kernel with headers installed. The Compute Engine virtual network driver supports building against mainline and major distribution kernels for versions 3.10 and later.
Install or update kernel and headers to version 3.10 or later. To complete this step, review the documentation for your operating system. Source code and driver packages can be obtained from GitHub, see GoogleCloudPlatform/compute-virtual-ethernet-linux.
Use your image to create and start a VM instance.
On this VM instance, load the kernel driver. To load the driver run the following command:
modprobe gve
This command loads the driver until you either reboot the system or remove the driver with the
rmmod
command.(Optional) To ensure that the driver loads automatically when the system boots, run one of the following commands:
For operating systems that use systemd, run the following command:
echo gve > /etc/modules-load.d/gve.conf
For Debian systems, run the following command:
echo gve >> /etc/modules
Stop the VM instance.
Create an image from the disk that is attached to the VM instance that you just stopped.
gcloud beta compute images create image-name\ --source-disk disk-name \ --guest-os-features=GVNIC
Replace the following:
image-name
: The name of the image that you want to create. This image has the Compute Engine virtual network driver installed.disk-name
: The name of the boot disk on the VM instance that you just stopped.
Use the image, which has the Compute Engine virtual network driver installed, to create and start a VM instance.
Windows
Use your image to create and start a VM instance.
On this VM instance, install GooGet. To install GooGet, see Download and install GooGet.
Install the gVNIC driver. To install the driver, run the following command in an elevated PowerShell prompt:
googet install google-compute-engine-driver-gvnic
Stop the VM instance.
Create an image from the disk that is attached to the VM instance that you just stopped.
gcloud beta compute images create image-name\ --source-disk disk-name \ --guest-os-features=GVNIC
Replace the following:
image-name
: The name of the image that you want to create. This image now has the Compute Engine virtual network driver installed.disk-name
: The name of the boot disk on the VM instance that you just stopped.
Use the image, which has the Compute Engine virtual network driver installed, to create and start a VM instance.
Verifying that the Compute Engine virtual network interface is enabled
Linux
Method 1
On your Linux VM instance, run the following commands:
sudo apt-get install pciutils lspci
The output should resemble the following:
00:04.0 Ethernet controller: Google, XXX. Device 0042
Method 2
Follow the instruction for your operating system to download the
ethtool
networking utility tool.Run the following command:
sudo ethtool -i network-interface
Replace
network-interface
with the name of your network interface. For example,eth0
.The output should resemble the following:
driver: gve version: 1.0.0 firmware-version: expansion-rom-version: bus-info: 0000:00:04.0 supports-statistics: yes supports-test: no supports-eeprom-access: no supports-register-dump: no supports-priv-flags: no
Windows
- On your Windows VM Instance, open the Device Manager.
- Under Network Adapters, you should see:
"Google Ethernet Adapter"
Troubleshooting
VM instance didn't boot
Cause: Compute Engine virtual network driver is not enabled on the image.
Diagnosis: Check that the image has Compute Engine virtual network interface enabled. To verify, run the following command:
gcloud beta compute images describe image-name
Replace
image-name
with the name of your image.The output of the command should show 'GVNIC' under
guestOsFeatures
.Resolution: Ensure that you are using a supported image or that you have properly set up the gVNIC driver on your custom image.
VM instance booted but is not reachable over the network
Cause: The Compute Engine virtual network driver was not successfully installed and loaded.
Diagnosis: To check if the driver was installed and loaded, complete the following steps:
Linux
Check that the driver is installed.
modinfo gve
The output should resemble the following:
filename: /lib/modules/4.15.0-1036-gcp/updates/dkms/gve.ko version: 1.0.0 license: Dual MIT/GPL description: gVNIC Driver author: Google, XXX. srcversion: 5FEFB9DD945EB2DEC94EE09 alias: pci:v00001AE0d00000042sv*sd*bc*sc*i* depends: retpoline: Y name: gve vermagic: 4.15.0-1036-gcp SMP mod_unload
Check that the driver is loaded.
lsmod | grep gve
The output should resemble the following:
gve 49152 0
Windows
- Connect to instance through SAC.
- Login with your username and password.
From the command prompt, run the following command:
dism /online /get-drivers | findstr gvnic
Review the result.
- If the driver is installed, you should see the text
Original File Name : gvnic.inf
in the output. - If the driver is not installed, no message is returned.
- If the driver is installed, you should see the text
Resolution: If the Compute Engine virtual network driver is not available, ensure that you are using a supported image or that you have properly set up the Compute Engine virtual network driver on your custom image.
What's next
- Connect to your instance.
- Add persistent disks to your new instance.