iproute版本太低无法加载ebpf obj文件,提示Error: either “dev“ is duplicate, or “xdpgeneric“ is a garbage.

iproute版本太低无法加载ebpf obj文件,执行ip link set dev lo xdpgeneric obj xdp_pass_kern.o sec xdp提示Error: either "dev" is duplicate, or "xdpgeneric" is a garbage.

[root@localhost basic01-xdp-pass]# ip link set dev lo xdpgeneric obj xdp_pass_kern.o sec xdp
Error: either "dev" is duplicate, or "xdpgeneric" is a garbage.

可以安装一个高版本的iproute,本例加载iproute2-5.11.0使用。

[root@localhost basic01-xdp-pass]# yum whatprovides `which ip`
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.njupt.edu.cn
 * elrepo: reflector.westga.edu
 * extras: mirrors.njupt.edu.cn
 * updates: mirrors.aliyun.com
iproute-4.11.0-30.el7.x86_64 : Advanced IP routing and network device configuration tools
Repo        : base
Matched from:
Filename    : /usr/sbin/ip



iproute-4.11.0-30.el7.x86_64 : Advanced IP routing and network device configuration tools
Repo        : @anaconda
Matched from:
Filename    : /usr/sbin/ip



[root@localhost basic01-xdp-pass]# module avail iproute
------------------------------------------------------------------------- /root/spack/share/spack/modules/linux-centos7-sandybridge -------------------------------------------------------------------------
iproute2-5.11.0-gcc-11.2.0-cwk2r6k

Key:
modulepath
[root@localhost basic01-xdp-pass]# module load iproute2-5.11.0-gcc-11.2.0-cwk2r6k
[root@localhost basic01-xdp-pass]# ip link set dev lo xdpgeneric obj xdp_pass_kern.o sec xdp
Continuing without mounted eBPF fs. Too old kernel?
[root@localhost basic01-xdp-pass]# ip link show dev lo
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 xdpgeneric qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    prog/xdp id 3 tag 3b185187f1855c4c

猜你喜欢

转载自blog.csdn.net/thesre/article/details/123311594