linux中如何修改网络命名空间中veth设备端点的名字?
查看原有的设备名称为veth1
[root@centos7 ~]# ip netns exec ns1 ip link 1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN mode DEFAULT group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 5: veth1@if6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000 link/ether 42:54:6d:73:c2:40 brd ff:ff:ff:ff:ff:ff link-netnsid 0
关闭网卡,否则修改报设备忙
[root@centos7 ~]# ip netns exec ns1 ip link set dev veth1 down [root@centos7 ~]#
修改设备的名字
[root@centos7 ~]# ip netns exec ns1 ip link set dev veth1 name eth0