DPDK-VPP 学习笔记-02
发布日期:2021-05-14 03:34:50 浏览次数:54 分类:精选文章

本文共 3781 字,大约阅读时间需要 12 分钟。

DPDK-VPP 学习笔记-02

启始配置

DPDK-VPP 启始配置如下:

unix {
nodaemon;
log /var/log/vpp/vpp.log;
full-coredump;
cli-listen /run/vpp/cli.sock;
}
socksvr {
default;
}
api-trace {
on;
}
cpu {
main-core 0;
corelist-workers 1-16,24-39;
scheduler-policy fifo;
scheduler-priority 50;
}
buffers {
buffers-per-numa 204800;
}
plugins {
path /usr/lib/vpp_plugins/:/usr/lib/vpp_api_test_plugins/;
plugin default { enable };
}
dpdk {
dev default {
num-rx-queues 16;
num-tx-queues 16;
num-rx-desc 2048;
num-tx-desc 2048;
devargs mprq_en=1,rxqs_min_mprq=1,txqs_min_inline=1;
}
num-mem-channels 4;
log-level debug;
socket-mem 32768;
dev 0000:19:00.1 {
name 100GE1/0/1;
}
dev 0000:54:00.1 {
name 100GE1/0/2;
}
no-multi-seg;
no-tx-checksum-offload;
}

L2 xconnect 配置

L2 xconnect 模式配置如下:

set interface state 100GE1/0/1 up;
set interface state 100GE1/0/2 up;
set interface l2 xconnect 100GE1/0/1 100GE1/0/2;
set interface l2 xconnect 100GE1/0/2 100GE1/0/1;
show mode 100GE1/0/1 100GE1/0/2;

如需取消 L2 xconnect 模式,将接口配置为 L3 模式:

set interface l3 100GE1/0/1;
set interface l3 100GE1/0/2;
show mode 100GE1/0/1 100GE1/0/2;

L2 bridge 配置

L2 bridge 配置如下:

set interface state 100GE1/0/1 up;
set interface state 100GE1/0/2 up;
set interface l2 bridge 100GE1/0/1 200;
set interface l2 bridge 100GE1/0/2 200;
show mode 100GE1/0/1 100GE1/0/2;
show bridge-domain 200 detail;

如需取消 L2 bridge 模式,将接口配置为 L3 模式:

set interface l3 100GE1/0/1;
set interface l3 100GE1/0/2;
show mode 100GE1/0/1 100GE1/0/2;

LACP 配置

LACP 配置如下:

set int mtu packet 1500 100GE1/0/1;
set int mtu packet 1500 100GE1/0/2;
set int state 100GE1/0/1 up;
set int state 100GE1/0/2 up;
create bond mode lacp load-balance l23;
set int mtu packet 1500 BondEthernet0;
bond add BondEthernet0 100GE1/0/1;
bond add BondEthernet0 100GE1/0/2;
set int ip address BondEthernet0 40.0.167.68/24;
set int state BondEthernet0 up;
show bond details;
show ip neighbors;

如需删除 LACP 配置:

bond del 100GE1/0/1;
bond del 100GE1/0/2;
delete bond BondEthernet0;

注:在 VPP 20.05.1 版本中,BondEthernet0 与交换机可能会不通,具体原因尚未确定。

L3 路由

L3 路由配置如下:

set int mtu packet 1500 100GE1/0/1;
set int mtu packet 1500 100GE1/0/2;
set int ip address 100GE1/0/1 40.0.148.68/24;
set int ip address 100GE1/0/2 40.0.147.68/24;
set int state 100GE1/0/1 up;
set int state 100GE1/0/2 up;

添加多路径路由:

ip route add 40.0.40.2/32 via 40.0.147.66 weight 1;
ip route add 40.0.40.2/32 via 40.0.148.66 weight 3;
show ip fib;

添加多路径等价路由:

ip route add 40.0.40.2/32 via 40.0.147.66;
ip route add 40.0.40.2/32 via 40.0.148.66;
show ip fib;

添加 VRF 路由:

ip route add 40.0.40.2/32 table 7 via 100GE1/0/1;
show ip fib;

删除路由:

ip route del 40.0.40.2/32 via 40.0.147.66;
ip route del 40.0.40.2/32 via 40.0.148.66;
show ip fib;

IPv6 地址配置:

enable ip6 interface 100GE1/0/1;
disable ip6 interface 100GE1/0/1;

添加接口路由表(VRF):

set interface ip table 100GE1/0/1 200;
set interface ip6 table 100GE1/0/1 201;

ACL 插件

ACL 插件配置如下:

vpp# set acl-plugin acl ?;
vpp# set acl-plugin acl [permit|deny] [src
] [dst
] [proto X sport X-Y dport X-Y [tag FOO]];
vpp# [이미지 harmless];

添加 ACL 到接口:

set acl-plugin acl permit src 40.0.0.0/16;
set acl-plugin acl deny dst 40.0.40.2/32;
set acl-plugin int 100GE1/0/1 input acl 0;
set acl-plugin int 100GE1/0/2 input acl 0;
set acl-plugin int 100GE1/0/1 input acl 1;
set acl-plugin int 100GE1/0/2 input acl 1;
show acl-plugin acl 0;
show acl-plugin acl 1;
show acl-plugin memory;
show acl-plugin sessions;
show acl-plugin tables;

移除 ACL:

set acl-plugin int 100GE1/0/1 input acl 0 del;
set acl-plugin int 100GE1/0/2 input acl 0 del;
set acl-plugin int 100GE1/0/1 input acl 1 del;
set acl-plugin int 100GE1/0/2 input acl 1 del;

清除 ACL 会话:

clear acl-plugin sessions;
上一篇:FastNetMon 使用笔记
下一篇:DPDK-VPP 学习笔记-01

发表评论

最新留言

很好
[***.229.124.182]2025年04月30日 17时30分03秒