Creating VM instances that use the gVNIC network interface

The gVNIC virtual network interface is specifically designed for use on Compute Engine, it enables higher network bandwidths by providing 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.

To create VM instances that use the gVNIC network interface, you can complete one of the following steps:

Before you begin

Limitations

The gVNIC 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 gVNIC 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

You can use any of these images to create a VM instance that, by default, uses the gVNIC 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

Where [INSTANCE_NAME] is the name of the 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
    

    Where [INSTANCE_NAME] is the name of the instance.

Manually installing the gVNIC driver

To create a VM instance from an image that does not have the gVNIC driver installed, you need to:

  1. Install the gVNIC driver on the image.
  2. Use the image, with the gVNIC driver installed, to create a VM instance.

Linux

Before you can install the gVNIC driver, you must install the latest versions of the kernel driver and header for your operating system. An instance that uses a gVNIC 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 gVNIC driver supports building against mainline and major distribution kernels for versions 3.10 and later.

  1. 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.

  2. Use your image to create and start a VM instance.

  3. 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 rmmodcommand.

  4. (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
      
  5. Stop the VM instance.

  6. 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
    

    Where:

    • [DISK_NAME] is the name of the boot disk on the VM instance that you just stopped.
    • [IMAGE_NAME] is the name of the image that you want to create. This image now has the gVNIC drivers installed.
  7. Use the image, which has the gVNIC drivers installed, to create and start a VM instance.

Windows

  1. Use your image to create and start a VM instance.

  2. On this VM instance, install GooGet. To install GooGet, see Download and install GooGet.

  3. Install the gVNIC driver. To install the driver, run the following command in an elevated PowerShell prompt:

    googet install google-compute-engine-driver-gvnic
    
  4. Stop the VM instance.

  5. 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
    

    Where:

    • [DISK_NAME] is the name of the boot disk on the VM instance that you just stopped.
    • [IMAGE_NAME] is the name of the image that you want to create. This image now has the gVNIC drivers installed.
  6. Use the image, which has the gVNIC drivers installed, to create and start a VM instance.

Verifying that the gVNIC network interface is enabled

Linux

Method 1

  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

  1. Follow the instruction for your operating system to download the ethtool networking utility tool.

  2. Run the following command:

     sudo ethtool -i [NETWORK_INTERFACE]
    

    where [NETWORK_INTERFACE] is the name of the 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

  1. On your Windows VM Instance, open the Device Manager.
  2. Under Network Adapters, you should see: "Google Ethernet Adapter"

Troubleshooting

VM instance didn't boot with a gVNIC device

  • Cause: gVNIC is not enabled on the image.

  • Diagnosis: Check that the image has gVNIC enabled. To verify, run the following command:

    gcloud beta compute images describe [IMAGE_NAME]
    

    Where [IMAGE_NAME] is the name of the 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 with a gVNIC device but is not reachable over the network

  • Cause: The gVNIC driver was not successfully installed and loaded.

  • Diagnosis: To check if the driver was installed and loaded, complete the following steps:

    Linux

    1. 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
      
    2. Check that the driver is loaded.

      lsmod | grep gve
      

      The output should resemble the following:

      gve                    49152  0

    Windows

    1. Connect to instance through SAC.
    2. Login with your username and password.
    3. From the command prompt, run the following command:

      dism /online /get-drivers | findstr gvnic
      
    4. 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.
  • Resolution: If the gVNIC driver is not available, ensure that you are using a supported image or that you have properly set up the gVNIC driver on your custom image.

What's next

Var denne siden nyttig? Si fra hva du synes:

Send tilbakemelding om ...

Compute Engine Documentation