1.查看网卡信息
代码语言:javascript
复制[root@localhost ~]# nmcli connection show
NAME UUID TYPE DEVICE
ens224 ed8c24af-32ce-41d4-9cb0-50457f650009 ethernet ens224
ens256 b060629f-f32e-4b8e-982e-529e97643d81 ethernet ens256
2.新增eth0和eth1网卡文件
代码语言:javascript
复制[root@localhost ~]# nmcli connection add con-name eth0 ifname ens224 type ethernet
[root@localhost ~]# nmcli connection add con-name eth1 ifname ens256 type ethernet
3.删除ens224和ens256网卡文件
代码语言:javascript
复制[root@localhost ~]# nmcli connection down ens224
[root@localhost ~]# nmcli connection down ens256
[root@localhost ~]# nmcli connection delete ens224
[root@localhost ~]# nmcli connection delete ens256
4.查看网卡的Mac地址
代码语言:javascript
复制[root@localhost ~]# ip link show
eth0:00:0c:29:ee:90:77
eth1:00:0c:29:ee:90:81
5.修改网卡配置文件的device名称并新增mac地址参数HWADDR
代码语言:javascript
复制[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
HWADDR=00:0c:29:ee:90:7
DEVICE=eth0
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth1
HWADDR=00:0c:29:ee:90:81
DEVICE=eth1
6.ip link修改device名称
代码语言:javascript
复制[root@localhost ~]# ip link set ens224 down
[root@localhost ~]# ip link set ens256 down
[root@localhost ~]# ip link set ens224 name eth0
[root@localhost ~]# ip link set ens256 name eth1
[root@localhost ~]# ip link set eth0 up
[root@localhost ~]# ip link set eth1 up
7.重新加载网卡文件
代码语言:javascript
复制[root@localhost ~]# nmcli connection up eth0
[root@localhost ~]# nmcli connection up eth1
[root@localhost ~]# nmcli connection reload
8.重启网络服务
代码语言:javascript
复制[root@localhost ~]# systemctl restart network.service
9.查看网卡信息
代码语言:javascript
复制[root@localhost ~]# nmcli connection show
NAME UUID TYPE DEVICE
eth0 e5966e4d-fa43-4e0c-8962-5403ca1c88eb ethernet eth0
eth1 0d1a07f5-a52f-4b38-b02f-405b0e3e32ac ethernet eth1