Enable faster network packet processing with DPDK Stay organized with collections Save and categorize content based on your preferences.
This document explains how to enable theData Plane Development Kit (DPDK) on avirtual machine (VM) instance for faster network packet processing.
DPDK is a framework for performance-intensive applications that require fastpacket processing, low latency, and consistent performance. DPDK provides a setof data plane libraries and a network interface controller (NIC) that bypass thekernel network and run directly in the user space. For example, enabling DPDK onyour VM is useful when running the following:
Network function virtualization (NFV) deployments
Software-defined networking (SDN) applications
Video streaming or voice over IP applications
You can run DPDK on a VM that uses one of the following virtual NIC (vNIC)types:
Recommended:gVNIC
A high-performance, secure, and scalable virtual network interfacespecifically designed for Compute Engine that succeeds virtIO as thenext generation vNIC.
An open source ethernet driver that lets VMs efficiently access physicalhardwares, such as block storage and networking adapters.
One issue with running DPDK in a virtual environment, instead of on physicalhardware, is that virtual environments lack support for SR-IOV and I/O MemoryManagement Unit (IOMMU) for high-performing applications. To overcome thislimitation, you must run DPDK on guest physical addresses rather than hostvirtual addresses by using one of the following drivers:
Before you begin
- If you haven't already, set upauthentication. Authentication verifies your identity 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
Install the Google Cloud CLI. After installation,initialize the Google Cloud CLI by running the following command:
gcloudinit
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update.- 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. After installation,initialize the Google Cloud CLI by running the following command:
gcloudinit
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update.For more information, seeAuthenticate for using REST in the Google Cloud authentication documentation.
Requirements
When creating a VM to run DPDK on, make sure of the following:
To avoid a lack of network connectivity when running your applications,use two Virtual Private Cloud networks:
A VPC network for the control plane
A VPC network for the data plane
The two VPC networks must both specify the following:
A subnet with a unique IP address range
The same region for their subnets
The same type of VNIC—either gVNIC or VirtIO-Net
When creating the VM:
You must specify the same region as the two VPC networks'subnets.
You must specify the vNIC type you plan to use with DPDK.
You must specify asupported machine seriesfor gVNIC or VirtIO-Net.
Restrictions
Running DPDK on a VM has the following restrictions:
You can only usesingle-stack subnets forthe two VPC networks used in the VM.
If you're using gVNIC as the vNIC type for the two VPCnetworks, make sure of the following:
You must use DPDK version 22.11 or later.
You can only usesupported disk images.
If you want to enableper VM Tier_1 networking performancefor higher network performance when creating the VM, you must specify thefollowing:
gVNIC as the vNIC type
Asupported machine typewith 30 vCPUs or more
Overview of DPDK features and versions
Google recommends using the most recent version of the DPDK driver to benefitfrom latest features and bug fixes. The following list provides an overviewof what is available with each version of the DPDK driver:
- 24.07
- Modify ring size support (for all supported machine types).
- Secondary process support.
- 24.03
- RSS support (for all supported machine types).
- 23.11
- RX buffer size support (for all supported machine types).
- Jumbo frame (9K) support forthird generation and later machine types.
- 23.07
- Added support for third generation and later machine types.
- Jumbo frame (9K) support for first and second generation machine types.
- 23.03
Support for reporting stats:
- Software stats for all supported machine types.
- Hardware stats for first and second generation machine types.
- 22.11
- Initial driver release with support for first and second generation machine types.
Configure a VM to run DPDK
This section explains how to create a VM to run DPDK on.
Create the VPC networks
Create two VPC networks, for the data plane and control plane,by using the Google Cloud console, Google Cloud CLI, or Compute Engine API.You can later specify these networks when creating the VM.
Console
Create a VPC network for the data plane:
In the Google Cloud console, go toVPC networks.
TheVPC networks page opens.
ClickCreate VPC network.
TheCreate a VPC network page opens.
In theName field, enter a name for your network.
In theNew subnet section, do the following:
In theName field, enter a name for your subnet.
In theRegion menu, select a region for your subnet.
SelectIPv4 (single-stack) (default).
In theIPv4 range, enter avalid IPv4 range address in CIDRnotation.
ClickDone.
ClickCreate.
TheVPC networks page opens. It can take up to a minute before thecreation of the VPC network completes.
Create a VPC network for the control plane with afirewall rule to allow SSH connections into the VM:
ClickCreate VPC network again.
TheCreate a VPC network page opens.
In theName field, enter a name for your network.
In theNew subnet section, do the following:
In theName field, enter a name for the subnet.
In theRegion menu, select the same region you specified forthe subnet of the data plane network.
SelectIPv4 (single-stack) (default).
In theIPv4 range, enter avalid IPv4 range address in CIDRnotation.
Important: Specify a different IPv4 range than the one you specified in the subnet for the data plane network. Otherwise, creating the network fails.ClickDone.
In theIPv4 firewall rules tab, select theNETWORK_NAME-allow-ssh checkbox.
WhereNETWORK_NAME is the network name you specifiedin the previous steps.
ClickCreate.
TheVPC networks page opens. It can take up to a minute before thecreation of the VPC network completes.
gcloud
To create a VPC network for the data plane, follow thesesteps:
Create a VPC network with a manually-created subnetby using the
gcloud compute networks createcommandwith the--subnet-modeflag set tocustom.gcloud compute networks createDATA_PLANE_NETWORK_NAME \ --bgp-routing-mode=regional \ --mtu=MTU \ --subnet-mode=customReplace the following:
DATA_PLANE_NETWORK_NAME: the name for theVPC network for the data plane.MTU: the maximum transmission unit (MTU), whichis the largest packet size of the network. The value must be between1300and8896. The default value is1460. Before setting theMTU to a value higher than1460, seeMaximum transmission unit.
Create a subnet for the VPC data plane network you'vejust created by using the
gcloud compute networks subnets createcommand.gcloud compute networks subnets createDATA_PLANE_SUBNET_NAME \ --network=DATA_PLANE_NETWORK_NAME \ --range=DATA_PRIMARY_RANGE \ --region=REGIONReplace the following:
DATA_PLANE_SUBNET_NAME: the name of the subnetfor the data plane network.DATA_PLANE_NETWORK_NAME: the name of the dataplane network you specified in the previous steps.DATA_PRIMARY_RANGE: avalid IPv4 range for the subnet inCIDR notation.REGION: the region where to create the subnet.
To create a VPC network for the control plane with afirewall rule to allow SSH connections into the VM, follow these steps:
Create a VPC network with a manually-created subnetby using the
gcloud compute networks createcommandwith the--subnet-modeflag set tocustom.gcloud compute networks createCONTROL_PLANE_NETWORK_NAME \ --bgp-routing-mode=regional \ --mtu=MTU \ --subnet-mode=customReplace the following:
CONTROL_PLANE_NETWORK_NAME: the name for theVPC network for the control plane.MTU: the MTU, which is the largest packet size ofthe network. The value must be between1300and8896. Thedefault value is1460. Before setting the MTU to a value higherthan1460, seeMaximum transmission unit.
Create a subnet for the VPC control plane networkyou've just created by using the
gcloud compute networks subnets createcommand.gcloud compute networks subnets createCONTROL_PLANE_SUBNET_NAME \ --network=CONTROL_PLANE_NETWORK_NAME \ --range=CONTROL_PRIMARY_RANGE \ --region=REGIONReplace the following:
CONTROL_PLANE_SUBNET_NAME: the name of the subnetfor the control plane network.CONTROL_PLANE_NETWORK_NAME: the name of thecontrol plane network you specified in the previous steps.
Important: Specify a different IPv4 range than the one youspecified in the data plane network's subnet. Otherwise, creatingthe subnet fails.CONTROL_PRIMARY_RANGE: avalid IPv4 range for the subnet inCIDR notation.REGION: the region where to create the subnet,which must match with the region you specified in the data planenetwork's subnet.
Create a VPC firewall rule that allows SSH connectionsto the control plane network by using the
gcloud compute firewall-rules createcommandwith the--allowflag set totcp:22.gcloud compute firewall-rules createFIREWALL_RULE_NAME \ --action=allow \ --network=CONTROL_PLANE_NETWORK_NAME \ --rules=tcp:22Replace the following:
FIREWALL_RULE_NAME: the name of the firewallrule.CONTROL_PLANE_NETWORK_NAME: the name of thecontrol plane network you created in the previous steps.
API
To create a VPC network for the data plane, follow thesesteps:
Create a VPC network with a manually-created subnetby making a
POSTrequest to thenetworks.insertmethodwith theautoCreateSubnetworksfield set tofalse.POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/global/networks{ "autoCreateSubnetworks": false, "name": "DATA_PLANE_NETWORK_NAME", "mtu":MTU}Replace the following:
PROJECT_ID: the project ID of the currentproject.DATA_PLANE_NETWORK_NAME: the name for the networkfor the data plane.MTU: the maximum transmission unit (MTU), whichis the largest packet size of the network. The value must be between1300and8896. The default value is1460. Before setting theMTU to a value higher than1460, seeMaximum transmission unit.
Create a subnet for the VPC data plane network bymaking a
POSTrequest to thesubnetworks.insertmethod.POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/subnetworks{ "ipCidrRange": "DATA_PRIMARY_RANGE", "name": "DATA_PLANE_SUBNET_NAME", "network": "projects/PROJECT_ID/global/networks/DATA_PLANE_NETWORK_NAME"}Replace the following:
PROJECT_ID: the project ID of the project wherethe data plane network is located.REGION: the region where you want to create thesubnet.DATA_PRIMARY_RANGE: the primaryIPv4 rangefor the new subnet in CIDR notation.DATA_PLANE_SUBNET_NAME: the name of the subnetfor the data plane network you created in the previous step.DATA_PLANE_NETWORK_NAME: the name of the dataplane network you created in the previous step.
To create a VPC network for the control plane with afirewall rule to allow SSH connections to the VM, follow these steps:
Create a VPC network with a manually-created subnetby making a
POSTrequest to thenetworks.insertmethodwith theautoCreateSubnetworksfield set tofalse.POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/global/networks{ "autoCreateSubnetworks": false, "name": "CONTROL_PLANE_NETWORK_NAME", "mtu":MTU}Replace the following:
PROJECT_ID: the project ID of the currentproject.CONTROL_PLANE_NETWORK_NAME: the name for thenetwork for the control plane.MTU: the MTU, which is the largest packet size ofthe network. The value must be between1300and8896. Thedefault value is1460. Before setting the MTU to a value higherthan1460, seeMaximum transmission unit.
Create a subnet for the VPC data control network bymaking a
POSTrequest to thesubnetworks.insertmethod.POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/subnetworks{ "ipCidrRange": "CONTROL_PRIMARY_RANGE", "name": "CONTROL_PLANE_SUBNET_NAME", "network": "projects/PROJECT_ID/global/networks/CONTROL_PLANE_NETWORK_NAME"}Replace the following:
PROJECT_ID: the project ID of the project wherethe control plane network is located.REGION: the region where you want to create thesubnet.
Important: Specify a different IPv4 range than the one youspecified in the data plane network's subnet. Otherwise, creatingthe subnet fails.CONTROL_PRIMARY_RANGE: the primaryIPv4 rangefor the new subnet in CIDR notation.CONTROL_PLANE_SUBNET_NAME: the name of the subnetfor the control plane network you created in the previous step.CONTROL_PLANE_NETWORK_NAME: the name of thecontrol plane network you created in the previous step.
Create a VPC firewall rule that allows SSH connectionsto the control plane network by making a
POSTrequest to thefirewalls.insertmethod.In the request, set theIPProtocolfield totcpand theportsfield to22.POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/global/firewalls{ "allowed": [ { "IPProtocol": "tcp", "ports": [ "22" ] } ], "network": "projects/PROJECT_ID/global/networks/CONTROL_PLANE_NETWORK_NAME"}Replace the following:
PROJECT_ID: the project ID of the project wherethe control plane network is located.CONTROL_PLANE_NETWORK_NAME: the name of thecontrol plane network you created in the previous steps.
For more configuration options when creating a VPC network, seeCreate and manage VPC networks.
Create a VM that uses the VPC networks for DPDK
Create a VM that enables gVNIC or virtIO-Net on the two VPCnetworks that you created previously by using the Google Cloud console,gcloud CLI, and Compute Engine API.
Recommended: SpecifyUbuntu LTS orUbuntu Pro as the operating systemimage because of their package manager support for the UIO and IOMMU-less VFIOdrivers. If you don't want to specify any of these operating systems, specifyingDebian 11 or later is recommended forfaster packet processing.
Console
Create a VM that uses the two VPC network subnets you createdin the previous steps by doing the following:
In the Google Cloud console, go toVM instances.
TheVM instances page opens.
ClickCreate instance.
TheCreate an instance page opens.
In theName field, enter a name for your VM.
In theRegion menu, select the same region where you created yournetworks in the previous steps.
Important: Attempting to create a VM in a different region from wherethe control and data plane networks exist causes errors.In theZone menu, select a zone for your VM.
In theMachine configuration section, do the following:
Select one of the following options:
For common workloads, select theGeneral purpose tab (default).
For performance-intensive workloads, select theCompute optimized tab.
For high memory-to-vCPUs ratios workloads, select theMemory optimized tab.
For workloads that use Graphics processing units (GPUs), select theGPUs tab.
Optional. If you specifiedGPUs in the previous step and you wantto change the GPU to attach to the VM, do one or more of thefollowing:
In theGPU type menu, select a type of GPU.
In theNumber of GPUs menu, select the number of GPUs.
In theSeries menu, select a machine series.
Important: gVNIC is supported with all machine series, but VirtIO-Netis not supported with the newest machine series (third generation andT2A). If you choose a machine series that doesn't support your vNICtype, creating the VM fails.In theMachine type menu, select a machine type.
Optional: ExpandAdvanced configurations, and follow the promptsto further customize the machine for this VM.
Optional: In theBoot disk section, clickChange, and then followthe prompts to change the disk image.
Important: If you specify gVNIC as the vNIC type for this VM, make sure tospecify asupported disk image.Otherwise, creating the VM fails.Expand theAdvanced options section.
Expand theNetworking section.
In theNetwork performance configuration section, do the following:
In theNetwork interface card menu, select one of the following:
To use gVNIC, selectgVNIC.
To use VirtIO-Net, selectVirtIO.
Optional: For higher network performance and reduced latency, selecttheEnable Tier_1 networking checkbox.
Important: You can only enable Tier_1 networking when you usegVNIC and specify asupported machine typethat has 30 vCPUs or more. Otherwise, creating the VM fails.
In theNetwork interfaces section, do the following:
In thedefault row, clickDelete item "default".
ClickAdd network interface.
TheNew network interface section appears.
In theNetwork menu, select the control plane network you createdin the previous steps.
ClickDone.
ClickAdd network interface again.
TheNew network interface section appears.
In theNetwork menu, select the data plane network you created inthe previous steps.
ClickDone.
ClickCreate.
TheVM instances page opens. It can take up to a minute before thecreation of the VM completes.
gcloud
Create a VM that uses the two VPC network subnets you createdin the previous steps by using thegcloud compute instances create commandwith the following flags:
gcloud compute instances createVM_NAME \ --image-family=IMAGE_FAMILY \ --image-project=IMAGE_PROJECT \ --machine-type=MACHINE_TYPE \ --network-interface=network=CONTROL_PLANE_NETWORK_NAME,subnet=CONTROL_PLANE_SUBNET_NAME,nic-type=VNIC_TYPE \ --network-interface=network=DATA_PLANE_NETWORK_NAME,subnet=DATA_PLANE_SUBNET_NAME,nic-type=VNIC_TYPE \ --zone=ZONEReplace the following:
VM_NAME: the name of the VM.IMAGE_FAMILY: the image family for the operating systemthat the boot disk will be initialized with. Alternatively, you can specifythe--image=IMAGEflag and replaceIMAGEwith a specific version of an image. Learn how toview a list of imagesavailable in the Compute Engine images project.
Important: If you specify gVNIC as the vNIC type for this VM, make sure tospecify asupported image family and project.Otherwise, creating the VM fails.IMAGE_PROJECT: the name of the image project thatcontains the disk image.
Important: gVNIC is supported with all machine series, but VirtIO-Net isnot supported with the newest machine series (third generation and T2A).If you choose a machine series that doesn't support your vNIC type,creating the VM fails.MACHINE_TYPE: a machine type,predefined orcustom,for the VM.VNIC_TYPE: the vNIC type to use for the control plane anddata plane networks. The value must be one of the following:To use gVNIC, specify
GVNIC.To use VirtIO-Net, specify
VIRTIO_NET.
CONTROL_PLANE_NETWORK_NAME: the name of the control planenetwork you created in the previous steps.CONTROL_PLANE_SUBNET_NAME: the name of the subnet for thecontrol plane network you created in the previous steps.DATA_PLANE_NETWORK_NAME: the name of the data planenetwork you created in the previous steps.DATA_PLANE_SUBNET_NAME: the name of the subnet for thecontrol plane network you automatically created in the previous steps.ZONE: the zone where to create the VM in. Specify a zonewithin the same region of the subnet you created in the previous steps.
For example, to create a VM nameddpdk-vm in theus-central1-a zone thatspecifies a SSD persistent disk of 512 GB, a predefined C2 machine type with60 vCPUs, Tier_1 networking, and a data plane and a control plane networkthat both use gVNIC, run the following command:
gcloud compute instances create dpdk-vm \ --boot-disk-size=512GB \ --boot-disk-type=pd-ssd \ --image-project=ubuntu-os-cloud \ --image-family=ubuntu-2004-lts \ --machine-type=c2-standard-60 \ --network-performance-configs=total-egress-bandwidth-tier=TIER_1 \ --network-interface=network=control,subnet=control,nic-type=GVNIC \ --network-interface=network=data,subnet=data,nic-type=GVNIC \ --zone=us-central1-aAPI
Create a VM that uses the two VPC network subnets you createdin the previous steps by making aPOST request to theinstances.insert methodwith the following fields:
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances{ "name": "VM_NAME", "machineType": "MACHINE_TYPE", "disks": [ { "initializeParams": { "sourceImage": "projects/IMAGE_PROJECT/global/images/IMAGE_FAMILY" } } ], "networkInterfaces": [ { "network": "global/networks/CONTROL_PLANE_NETWORK_NAME", "subnetwork": "regions/REGION/subnetworks/CONTROL_PLANE_SUBNET_NAME", "nicType": "VNIC_TYPE" }, { "network": "global/networks/DATAPLANE_NETWORK_NAME", "subnetwork": "regions/REGION/subnetworks/DATA_PLANE_SUBNET_NAME", "nicType": "VNIC_TYPE" } ]}Replace the following:
PROJECT_ID: the project ID of the project where thecontrol plane VPC network and the data planeVPC network are located.
Important: Make sure to specify a zone that meets the followingrequirements:ZONE: the zone where to create the VM in.- The zone is within the same region where the subnets of the controland data plane networks are located.
- The zone of the VM and the zone containing the machine type to use forthe VM are matching.
VM_NAME: the name of the VM.
Important: gVNIC is supported with all machine series, but VirtIO-Net isnot supported with the newest machine series (third generation and T2A).If you choose a machine series that doesn't support your vNIC type,creating the VM fails.MACHINE_TYPE: a machine type,predefined orcustom,for the VM.IMAGE_PROJECT: the name of the image project thatcontains the disk image.
Important: If you specify gVNIC as the vNIC type for this VM, make sure tospecify asupported disk image.Otherwise, creating the VM fails.IMAGE_FAMILY: the image family for the operating systemthat the boot disk will be initialized with. Alternatively, you can specifya specific version of an image. Learn how toview a list of imagesin the Compute Engine images project.CONTROL_PLANE_NETWORK_NAME: the name of the control planenetwork you created in the previous steps.REGION: the region where the subnets of the control planeand data plane networks exist.CONTROL_PLANE_SUBNET_NAME: the name of the subnet for thecontrol plane network you created in the previous steps.VNIC_TYPE: the vNIC type to use for the control plane anddata plane networks. The value must be one of the following:To use gVNIC, specify
GVNIC.To use VirtIO-Net, specify
VIRTIO_NET.
DATA_PLANE_NETWORK_NAME: the name of the data planenetwork you created in the previous steps.DATA_PLANE_SUBNET_NAME: the name of the subnet for thecontrol plane network you created in the previous steps.
For example, to create a VM nameddpdk-vm in theus-central1-a zone thatspecifies a SSD persistent disk of 512 GB, a predefined C2 machine type with60 vCPUs, Tier_1 networking, and a data plane and a control plane networkthat both use gVNIC, make the followingPOST request:
POST https://compute.googleapis.com/compute/v1/projects/example-project/zones/us-central1-a/instances{ "name": "dpdk-vm", "machineType": "c2-standard-60", "disks": [ { "initializeParams": { "diskSizeGb": "512GB", "diskType": "pd-ssd", "sourceImage": "projects/ubuntu-os-cloud/global/images/ubuntu-2004-lts" }, "boot": true } ], "networkInterfaces": [ { "network": "global/networks/control", "subnetwork": "regions/us-central1/subnetworks/control", "nicType": "GVNIC" }, { "network": "global/networks/data", "subnetwork": "regions/us-central1/subnetworks/data", "nicType": "GVNIC" } ], "networkPerformanceConfig": { "totalEgressBandwidthTier": "TIER_1" }}For more configuration options when creating a VM, seeCreate and start a VM instance.
Install DPDK on your VM
To install DPDK on your VM, follow these steps:
Connect to the VM you created in the previous section byusing SSH.
Configure the dependencies for DPDK installation:
sudo apt-get update && sudo apt-get upgrade -yqsudo apt-get install -yq build-essential ninja-build python3-pip \ linux-headers-$(uname -r) pkg-config libnuma-devsudo pip install pyelftools mesonInstall DPDK:
Important: If you specified gVNIC as the vNIC type in the previous steps,you must install DPDK version 22.11 or later. Using an earlier version ofDPDK causes errors when you try to test or use DPDK on your VM.wget https://fast.dpdk.org/rel/dpdk-23.07.tar.xztar xvf dpdk-23.07.tar.xzcd dpdk-23.07To build DPDK with the examples:
meson setup -Dexamples=all buildsudo ninja -C build install; sudo ldconfig
Install driver
To prepare DPDK to run on a driver, install the driver by selecting one of thefollowing methods:
Install a IOMMU-less VFIO
To install the IOMMU-less VFIO driver, follow these steps:
Check if VFIO is enabled:
cat /boot/config-$(uname -r) | grep NOIOMMUIf VFIO isn't enabled, then follow the steps inInstall UIO.
Enable theNo-IOMMU modein VFIO:
sudo bash -c 'echo 1 > /sys/module/vfio/parameters/enable_unsafe_noiommu_mode'
Install UIO
To install the UIO driver on DPDK, select one of the following methods:
Install UIO by using git
To install the UIO driver on DPDK by usinggit, follow these steps:
Clone the
igb_uiogit repositoryto a disk in your VM:git clone https://dpdk.org/git/dpdk-kmodsFrom the parent directory of the cloned git repository, build the module andinstall the UIO driver on DPDK:
pushd dpdk-kmods/linux/igb_uiosudo makesudo depmod && sudo insmod igb_uio.kopopd
Install UIO by using Linux packages
To install the UIO driver on DPDK by using Linux packages, follow these steps:
Install the
dpdk-igb-uio-dkmspackage:sudo apt-get install -y dpdk-igb-uio-dkmsInstall the UIO driver on DPDK:
sudo modprobe igb_uio
Bind DPDK to a driver and test it
To bind DPDK to the driver you installed in the previous section, follow thesesteps:
Get the Peripheral Component Interconnect (PCI) slot number for the currentnetwork interface:
sudo lspci | grep -e "gVNIC" -e "Virtio network device"For example, if the VM is using
ens4as the network interface, the PCIslot number is00:04.0.Stop the network interface connected to the network adaptor:
sudo ip link setNETWORK_INTERFACE_NAME downReplace
NETWORK_INTERFACE_NAMEwith the name of thenetwork interface specified in the VPC networks. To see whichnetwork interface the VM is using, view the configuration of the networkinterface:sudo ifconfigBind DPDK to the driver:
sudo dpdk-devbind.py --bind=DRIVERPCI_SLOT_NUMBERReplace the following:
DRIVER: the driver to bind DPDK on. Specify one of thefollowing values:UIO driver:
igb_uioIOMMU-less VFIO driver:
vfio-pci
PCI_SLOT_NUMBER: the PCI slot number of the currentnetwork interface formatted as00:0NUMBER.0.
Create the
/mnt/hugedirectory, and then create some hugepages for DPDK touse for buffers:sudo mkdir /mnt/hugesudo mount -t hugetlbfs -o pagesize=1G none /mnt/hugesudo bash -c 'echo 4 > /sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages'sudo bash -c 'echo 1024 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages'Test that DPDK can use the network interface you created in the previoussteps by running the
testpmdexample application that is included with theDPDK libraries:sudo ./build/app/dpdk-testpmdFor more information about testing DPDK, seeTestpmd Command-line Options.
Unbind DPDK
After using DPDK, you can unbind it from the driver you've installed in theprevious section. To unbind DPDK, follow these steps:
Unbind DPDK from the driver:
sudo dpdk-devbind.py -uPCI_SLOT_NUMBERReplace
PCI_SLOT_NUMBERwith the PCI slot number youspecified in the previous steps. If you want to verify the PCI slot numberfor the current network interface:sudo lspci | grep -e "gVNIC" -e "Virtio network device"For example, if the VM is using
ens4as the network interface, the PCIslot number is00:04.0.Reload the Compute Engine network driver:
sudo bash -c 'echoPCI_SLOT_NUMBER > /sys/bus/pci/drivers/VNIC_DIRECTORY/bind'sudo ip link setNETWORK_INTERFACE_NAME upReplace the following:
PCI_SLOT_NUMBER: the PCI slot number you specifiedin the previous steps.VNIC_DIRECTORY: the directory of the vNIC. Depending onthe vNIC type you're using, specify one of the following values:gVNIC:
gvnicVirtIO-Net:
virtio-pci
NETWORK_INTERFACE_NAME: the name of the networkinterface you specified in the previous section.
What's next
Review thenetwork bandwidth ratesfor your machine type.
Learn more aboutcreating and managing VPC networks.
Learn more abouthigher MTU settings with jumbo frames.
Learn more aboutTCP optimization for network performance.
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-12-15 UTC.