通过VPP 的 VCL API,可以在不修改应用的情况下,使应用通过VPP 访问网络。
本实验将虚拟机的网卡桥接到家庭网络中,VPP接管网卡,并打开dhcp client,获取路由器分配的IP。
startup.conf
unix {
interactive
cli-listen /run/vpp/cli.sock
gid 0
startup-config ./init_cli
}
dpdk {
dev 0000:0b:00.0{
name eth1
}
}
api-trace {
on
}
socksvr {
default
}
cpu {
main-core 1
corelist-workers 2,3
}
buffers {
buffers-per-numa 128000
}
plugins {
plugin oddbuf_plugin.so { enable }
}
init_cli
set interface state eth1 up
set dhcp client intfc eth1
启动VPP
确保获取到ip地址
打开新终端,并配置环境变量
export VCL_CONFIG=/root/vpp/vpp_learn/vcl.conf
export LD_PRELOAD=/root/vpp/vpp_learn/build-root/build-vpp_debug-native/vpp/lib/x86_64-linux-gnu/libvcl_ldpreload.so
执行wget
我用的这个版本VCL API 还是有很多不兼容的问题,执行ping会导致VPP崩溃,执行curl 会卡住,无法解析域名 。wget,ssh,iperf 都可以正常运行。