前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >RHEL7修改网卡名称

RHEL7修改网卡名称

原创
作者头像
用户8006012
发布2022-03-31 17:43:47
2.1K0
发布2022-03-31 17:43:47
举报
文章被收录于专栏:DATABASE
代码语言:javascript
复制
[root@p19c01 ~]# nmcli connection show
NAME    UUID                                  TYPE      DEVICE 
ens33   1cfeef58-9472-4de5-bbbd-eef213e0d0ed  ethernet  ens33  
ens34   b61429a4-31b7-4d4d-9d4b-b9626fad6a46  ethernet  ens34  
virbr0  d11c0e62-383f-406a-9cd5-c17ef2869251  bridge    virbr0 
[root@p19c01 ~]# nmcli connection add con-name eth0 ifname ens33 type ethernet
Connection 'eth0' (72b6ecc8-0172-4cf7-9bc8-cb32578c3a3f) successfully added.
[root@p19c01 ~]# nmcli connection add con-name eth1 ifname ens34 type ethernet
Connection 'eth1' (cf619530-3827-433d-8664-a652814066a3) successfully added.
[root@p19c01 ~]# nmcli connection down ens33
Connection 'ens33' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4)
[root@p19c01 ~]# nmcli connection down ens34
Connection 'ens34' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/5)
[root@p19c01 ~]# nmcli connection show
NAME    UUID                                  TYPE      DEVICE 
eth0    72b6ecc8-0172-4cf7-9bc8-cb32578c3a3f  ethernet  ens33  CONFGI
eth1    cf619530-3827-433d-8664-a652814066a3  ethernet  ens34  
virbr0  d11c0e62-383f-406a-9cd5-c17ef2869251  bridge    virbr0 
ens33   1cfeef58-9472-4de5-bbbd-eef213e0d0ed  ethernet  --     
ens34   b61429a4-31b7-4d4d-9d4b-b9626fad6a46  ethernet  --     
[root@p19c01 ~]# nmcli connection delete ens33
Connection 'ens33' (1cfeef58-9472-4de5-bbbd-eef213e0d0ed) successfully deleted.
[root@p19c01 ~]# nmcli connection delete ens34
Connection 'ens34' (b61429a4-31b7-4d4d-9d4b-b9626fad6a46) successfully deleted.
[root@p19c01 ~]# nmcli connection show
NAME    UUID                                  TYPE      DEVICE 
virbr0  d11c0e62-383f-406a-9cd5-c17ef2869251  bridge    virbr0 
eth0    72b6ecc8-0172-4cf7-9bc8-cb32578c3a3f  ethernet  --     
eth1    cf619530-3827-433d-8664-a652814066a3  ethernet  --     
[root@p19c01 ~]# ip link show

[root@p19c01 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
HWADDR=00:50:56:2b:8c:62
DEVICE=eth0
[root@p19c01 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth1
#注释掉uuid
#新增HWADDR和DEVICE
HWADDR=00:50:56:3b:20:31
DEVICE=eth1


TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eth0
#UUID=72b6ecc8-0172-4cf7-9bc8-cb32578c3a3f
DEVICE=eth0
HWADDR=00:50:56:2b:8c:62
IPADDR=192.168.30.50
PREFIX=24
GATEWAY=192.168.30.254
ONBOOT=yes


[root@p19c01 rules.d]# vim /etc/udev/rules.d/70-persistent-ipoib.rules
SUBSYSTEM==”net”,ACTION==”add”,DRIVERS==”?*”,ATTR{address}==”00:50:56:2b:8c:62”,ATTR{type}==”1″ ,KERNEL==”eth*”,NAME=”eth0″
SUBSYSTEM==”net”,ACTION==”add”,DRIVERS==”?*”,ATTR{address}==”00:50:56:3b:20:31”,ATTR{type}==”1″ ,KERNEL==”eth*”,NAME=”eth1″

[root@p19c01 rules.d]# ip link set ens33 down
[root@p19c01 rules.d]# ip link set ens34 down
[root@p19c01 rules.d]# ip link set ens33 name eth0
[root@p19c01 rules.d]# ip link set ens34 name eth1
[root@p19c01 rules.d]# ip link set eth0 up
[root@p19c01 rules.d]# ip link set eth1 up
[root@p19c01 rules.d]# nmcli connection up eth0

[root@p19c01 rules.d]# nmcli connection reload

[root@p19c01 rules.d]# systemctl restart network.service
[root@p19c01 rules.d]# nmcli connection show
NAME    UUID                                  TYPE      DEVICE 
eth0    72b6ecc8-0172-4cf7-9bc8-cb32578c3a3f  ethernet  eth0   
eth1    cf619530-3827-433d-8664-a652814066a3  ethernet  eth1   
virbr0  a8afec99-5014-46fc-a8bf-c8a555d3d0ef  bridge    virbr0 

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档