1 下载
git clone https://gerrit.fd.io/r/vpp
2 安装依赖环境
cd vpp
yum install -y epel-release python-pip net-tools
make install-dep
centos debug:http://debuginfo.centos.org/7/x86_64/
3 安装dpdk,执行第4步代码编译时,会自动下载dpdk并一起编译(可忽略)
make dpdk-install-dev
4 进行代码编译(make distclean 可以清除编译生成文件 )
make build
5 制作rpm包
make pkg-rpm
6 安装VPP
[root@localhost vpp]# cd build-root/
[root@localhost build-root]# rpm -i vpp*.rpm
7 启动VPP
[root@localhost ~]# systemctl enable vpp
[root@localhost ~]# systemctl start vpp
[root@localhost ~]# systemctl status vpp.service
8 测试安装是否成功
[root@localhost ~]# vppctl
9 配置文件
vim /etc/vpp/startup.conf
#参考网站https://wiki.fd.io/view/VPP/Command-line_Arguments
#参考代码中自带的 startup.conf 文件中的解释说明
unix {
#交互模式
interactive
#使用telnet 127.0.0.1 5002访问
cli-listen 127.0.0.1:5002
log /tmp/vpp.log
full-coredump
}
cpu {
#主线程运行在0核
main-core 0
#工作线程运行的cpu 16位掩码
coremask-workers 2
}
dpdk {
#使用的驱动
uio-driver igb_uio
#使用的dev 及队列数
dev 0000:05:00.0 {num-rx-queues 2}
dev 0000:05:00.1 {num-rx-queues 2}
num-mbufs 65536
socket-mem 1024
}
api-trace {
on
}
api-segment {
gid vpp
}
7月 21 19:57:01 devel-ng-exporter-225 vpp[24116]: vpp[24116]: dpdk_config: unknown input `num-mbufs 10240 socket-mem 102...'
直接写个成:
dpdk {
#使用的驱动
#uio-driver igb_uio
#使用的dev 及队列数
dev 0000:00:08.0 {num-rx-queues 2}
dev 0000:00:09.0 {num-rx-queues 2}
#num-mbufs 10240
#socket-mem 1024
}
10 vpp基本命令
开启vpp systemctl start vpp.service
关闭vpp systemctl stop vpp.service
查看vpp状态 systemctl status vpp.service
vpp基本命令
交互模式
连接vpp telnet 127.0.0.1 5002
show interface
show ip arp
show ip fib
show error
clear run
show run
set int state GigabitEthernet6/0/0 up
set int ip address GigabitEthernet6/0/0 X.X.X.X/24
show threads
show dpdk interface placement
set interface l2 bridge GigabitEthernet6/0/0 1
非交互模式
vppctl show interface
vppctl show ip arp
vppctl show ip fib
vppctl show error
vppctl clear run
vppctl show run
vppctl set int state GigabitEthernet6/0/0 up
vppctl set int ip address GigabitEthernet6/0/0 X.X.X.X/24
vppctl show threads
vppctl show dpdk interface placement
vppctl set interface l2 bridge GigabitEthernet6/0/0 1
命令行参考
https://wiki.fd.io/view/VPP/Command-line_Interface_(CLI)_Guide
glibc debuginfo
/etc/yum.repos.d/CentOS-Base-debuginfo.repo
[base-debuginfo]
name=CentOS-$releasever - DebugInfo
baseurl=http://debuginfo.centos.org/$releasever/$basearch/
gpgcheck=0
enabled=0
protect=1
priority=1
在yum install xxxx 命令之后添加 --nogpgcheck 进行跳过公钥检查安装,完美解决!
debuginfo-install glibc-devel.x86_64 --nogpgcheck
[root@devel-ng-exporter-225 vdb1]# cat test.c
#include <stdio.h>
#include <string.h>
int main()
{
char str[10];
memcpy(str, "hello", 5);
printf("%s\n", str);
return 0;
}
gcc test.c -g -o test
[root@devel-ng-exporter-225 vdb1]# gdb test
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-51.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /mnt/vdb1/test...done.
(gdb) b memcpy
Breakpoint 1 at 0x4004a0
(gdb) r
Starting program: /mnt/vdb1/test
Breakpoint 1, memcpy () at ../sysdeps/x86_64/memcpy.S:61
61 cmpq $32, %rdx
(gdb) n
63 movq %rdi, %rax /* save return value */