bpftool 使用
bpftool 下载链接:
参考链接:https://blog.csdn.net/Longyu_wlz/article/details/109931993
问题:
[root@master ~]# bpftool -j feature probe
{"error":"bug: failed to retrieve CAP_BPF status: Invalid argument"}
解决:
升级bpftool
编译路径:
进入kernel源码:
linux-5.10.60/tools/bpf/bpftool
make
编译遇到的问题:
问题:
bfd.h: No such file or directory
解决:
yum install binutils-devel
#bpftool map list 6: percpu_hash name test_cilium_met flags 0x1 key 8B value 16B max_entries 65536 memlock 13631488B btf_id 3 7: perf_event_array name test_cilium_eve flags 0x0 key 4B value 4B max_entries 8 memlock 4096B
查看 map 内容
[root@master ~]# bpftool map dump pinned /sys/fs/bpf/tc/globals/cilium_lb4_reverse_nat [{ "key": 1280, "value": { "address": 167772426, "port": 49443 } },{ "key": 512, "value": { "address": 2650974400, "port": 1655 } },{ "key": 768, "value": { "address": 16777482, "port": 47873 } },{ "key": 1024, "value": { "address": 167772426, "port": 13568 } },{ "key": 256, "value": { "address": 2603417866, "port": 23040 } } ]