简体   繁体   中英

How to connect to the internet from DPDK running in a VM

DPDK is a library for kernel bypass packet processing: https://www.dpdk.org/ . F-Stack is a TCP/IP library built atop it: https://github.com/F-Stack/f-stack . I've set up a Linux VMWare VPN with two NICs, have given the second to DPDK, and am attempting to run a very simple test application on it that uses F-Stack and DPDK to connect to the internet. This is however failing (fails to connect).

When I attempt to run a simple server, it also fails, in that I cannot connect to it from Curl or a browser running in the VM.

The test application displays no errors (the DPDK initialisation works fine), and behaves correctly when the DPDK stuff is replaced with standard Linux networking functions that don't bypass the kernel.

My question is, is there anything I need to do to make the above setup work, so that DPDK running on the second NIC in my VM can connect to the internet? Eg set up some kind of mapping somewhere, or change the virtual network connection type on the VM (currently set to NAT). My networking knowledge is limited so it's quite possible I'm missing something very basic.

Summarizing the answer based on the updates from the comments as

Send packets directly between userspace and Kernel using DPDK, there are 3 options

  1. KNI PMD
  2. TUN/TAP PMD
  3. veth pair with one interface to DPDK via PCAP PMD.

the easiest way to try it out is by using DPDK example/skeleton with ./build/basicfwd -l 3 --vdev=net_tap0,ifaace=dpdk-kerenl0 -w [pcie bus address for DPDK NIC-2] . This will allow packets to send and receive over kernel via DPDK (where DPDK will act as pass-through). You can modify the basicfwd.c to process packets which you desire too.

If using FSTACK, I humbly request to check carrier section https://github.com/F-Stack/f-stack/blob/dev/README.md this makes use of KNI or veth to accomplish the same

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM