linux环境中,如何知道某个网络设备是可以被转移到其他的命名空间中的?

发布时间 2023-07-31 11:28:26作者: 安大

可以通过ethool工具进行查询,查询网络设备的属性

 

[root@centos7 ~]# ethtool -k enp0s3 | grep netns-local
netns-local: off [fixed]
[root@centos7 ~]# 
[root@centos7 ~]# ethtool -k lo | grep netns-local
netns-local: on [fixed]

 

如果查询出来的结果是:on,就说明这个网络设备不可以在网络命名空间中移动。

 

如果要将设备移动到不同的命名空间,就会报错无效参数

[root@centos7 ~]# ip link set lo netns ns1
RTNETLINK answers: Invalid argument
[root@centos7 ~]#