openeuler 2203 Linux 网卡名称,IP,MAC地址漂移解决方法

openeuler 2203 Linux 网卡名称,IP,MAC地址漂移解决方法

一,具体情况,

主机有4个网卡,全部使用中,发现其中一个网卡enp6s0网络不通,查看网卡信息名称变成了 rename3,

即便使用图形界面,也没法启动网卡enp6s0。

如下信息

[root@CE010101000001 ~]# ip addr show

2: enp5s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether cc:82:7f:35:12:67 brd ff:ff:ff:ff:ff:ff
altname enp4s0
inet 192.168.2.101/24 brd 192.168.2.255 scope global noprefixroute enp5s0
valid_lft forever preferred_lft forever
3: rename3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether cc:82:7f:35:12:68 brd ff:ff:ff:ff:ff:ff
inet 192.168.7.200/24 brd 192.168.7.255 scope global noprefixroute rename3
valid_lft forever preferred_lft forever
4: enp7s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether cc:82:7f:35:12:69 brd ff:ff:ff:ff:ff:ff
altname enp6s0
inet 192.168.0.101/24 brd 192.168.0.255 scope global noprefixroute enp7s0
valid_lft forever preferred_lft forever
5: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether cc:82:7f:35:12:66 brd ff:ff:ff:ff:ff:ff
altname enp0s31f6
inet 10.156.87.101/24 brd 10.156.87.255 scope global noprefixroute eno1
valid_lft forever preferred_lft forever

二,解决方法。

1,添加MAC地址绑定名称文件,重启系统,即可。

[root@CE010101000001 ~]# cat /etc/udev/rules.d/70-persistent-net.rules

SUBSYSTEM==“net”,ACTION==“add”,ATTR{address}==“cc:82:7f:35:12:66”,NAME=“eno1”
SUBSYSTEM==“net”,ACTION==“add”,ATTR{address}==“cc:82:7f:35:12:67”,NAME=“enp5s0”
SUBSYSTEM==“net”,ACTION==“add”,ATTR{address}==“cc:82:7f:35:12:68”,NAME=“enp6s0”
SUBSYSTEM==“net”,ACTION==“add”,ATTR{address}==“cc:82:7f:35:12:69”,NAME=“enp7s0”

2 Likes

一发话题 ,就提示 502

三,临时解决方法,无需重启系统

1,因为主机一直使用中,无法重启系统 ,只有想办法先联上网。

2,查看ifcfg-enp6s0网卡配置文件

[root@CE010101000001 ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp6s0

Generated by parse-kickstart

TYPE=Ethernet
DEVICE=enp6s0
#UUID=5c17e691-9b62-4098-a4e6-b941df037f0c
ONBOOT=yes
IPV6INIT=no
PROXY_METHOD=none
BROWSER_ONLY=no
IPV6_DISABLED=yes
NAME=enp6s0
HWADDR=CC:82:7F:35:12:68
BOOTPROTO=none
IPADDR=192.168.7.200
PREFIX=24
DEFROUTE=yes
IPV4_FAILURE_FATAL=no

3,发现uuid已经注释,不可能是uuid变了导致的(如uuid变了,可以注释UUID或修改UUID),HWADDR的MAC地址也绑定了,MAC地址也没变。看不出来什么问题,不清楚网卡名称怎么会变。

4,检查网卡的托管状态。

[root@CE010101000001 ~]# nmcli connection show

NAME UUID TYPE DEVICE
eno1 abf4c85b-57cc-4484-4fa9-b4a71689c359 ethernet eno1
enp6s0 b43fa2aa-5a85-7b0a-9a20-469067dba6d6 ethernet –

5,发现enp6s0 没有对应的DEVICE硬件网卡信息

6,断开rename3连接 ,可以发现只有rename3 没有enp6s0

[root@CE010101000001 ~]# nmcli device disconnect
br-38d02ba0def8 docker0 enp5s0 help rename3 veth65d9e04 vethebde10b

br-5d572960399a eno1 enp7s0 lo veth0d40262 vetha0077d5

[root@CE010101000001 ~]# nmcli device disconnect rename3
错误:断开设备 “rename3” (/org/freedesktop/NetworkManager/Devices/5) 的连接失败:This device is not active
错误:未断开所有设备的连接。

7,修改enp6s0配置文件,注释DEVICE绑定信息

[root@CE010101000001 ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp6s0

Generated by parse-kickstart

TYPE=Ethernet
#DEVICE=enp6s0
#UUID=5c17e691-9b62-4098-a4e6-b941df037f0c
ONBOOT=yes
IPV6INIT=no
PROXY_METHOD=none
BROWSER_ONLY=no
IPV6_DISABLED=yes
NAME=enp6s0
HWADDR=CC:82:7F:35:12:68
BOOTPROTO=none
IPADDR=192.168.7.200
PREFIX=24
DEFROUTE=yes
IPV4_FAILURE_FATAL=no

8,启动网卡enp6s0

[root@CE010101000001 ~]# ifup enp6s0
连接已成功激活(D-Bus 活动路径:/org/freedesktop/NetworkManager/ActiveConnection/7)

9,查看网卡托管状态与ip 信息正常,恢复通网。

[root@CE010101000001 ~]# nmcli connection show
NAME UUID TYPE DEVICE
eno1 abf4c85b-57cc-4484-4fa9-b4a71689c359 ethernet eno1
enp6s0 b43fa2aa-5a85-7b0a-9a20-469067dba6d6 ethernet rename3

[root@CE010101000001 ~]# ifconfig rename3
rename3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.7.200 netmask 255.255.255.0 broadcast 192.168.7.255
ether cc:82:7f:35:12:68 txqueuelen 1000 (Ethernet)
RX packets 508 bytes 65546 (64.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 579 bytes 74511 (72.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0xb1200000-b127ffff

2 Likes