centos 7更改默认网卡名称

 

[root@dev1-k8s-node-3 ~]# cd /etc/sysconfig/network-scripts/
[root@dev1-k8s-node-3 network-scripts]# cp ifcfg-ehs192 ifcfg-eth0
[root@dev1-k8s-node-3 network-scripts]# mv ifcfg-ehs192 ifcfg-ehs192-old
[root@dev1-k8s-node-3 network-scripts]# sed -i "s#ehs192#eth0#g" ifcfg-eth0

# 更改启动变量
[root@dev1-k8s-node-3 ~]# cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap biosdevname=0 net.ifnames=0 rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
[root@dev1-k8s-node-3 ~]# 

# 重启就变成eth0网卡了
[root@dev1-k8s-node-3 network-scripts]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:50:56:9d:7f:43 brd ff:ff:ff:ff:ff:ff
    inet 172.13.6.15/16 brd 172.13.255.255 scope global noprefixroute eth0
       valid_lft forever preferred_lft forever
[root@dev1-k8s-node-3 network-scripts]#

 

posted @ 2023-04-25 10:19  缺个好听的昵称  阅读(50)  评论(0编辑  收藏  举报