使用LD_PRELOAD可以让原来使用POSIX socket API的应用运行在VPP上。
步骤:
1. 启动vpp service.
2. 设置IP:
vppctl set interface mtu 1500 GigabitEthernet13/0/0
vppctl set interface ip address GigabitEthernet13/0/0 2.1.1.254/24
vppctl set int state GigabitEthernet13/0/0 up
3. LD_PRELOAD启动一个HTTP server:
# LD_PRELOAD="./build-root/rpmbuild/vpp-19.01/build-root/build-vpp-native/vpp/lib/libvcl_ldpreload.so" python -m SimpleHTTPServer 80
4. 用 # netstat -nptl | grep 80,查不到监听进程。从client端,可以访问该HTTP server:
wget http://2.1.1.254/some_file