首页 » Linux » Rocky 9 更改网卡名字

Rocky 9 更改网卡名字

 

由于安装之后,网卡名字可能是ens33之类的名字,以下是改变名字的方法:

# Rocky Linux 8 or 9 can use this
[root@idp ~]# mkdir /etc/systemd/network
[root@idp ~]# vi /etc/systemd/network/70-custom.link
[Match]
MACAddress=52:54:00:ea:a2:6b

[Link]
Name=idp0

# Rocky Linux 9 only operations
[root@idp ~]# mv /etc/NetworkManager/system-connections/enp1s0.nmconnection mv /etc/NetworkManager/system-connections/idp0.nmconnection
[root@idp ~]# sed -i 's/enp1s0/idp0/g' /etc/NetworkManager/system-connections/idp0.nmconnection
[root@idp ~]# init 6

. . .

[root@idp ~]# ip a s idp0
2: idp0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:ea:a2:6b brd ff:ff:ff:ff:ff:ff
    inet 10.100.0.13/24 brd 10.100.0.255 scope global noprefixroute idp0
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:feea:a26b/64 scope link noprefixroute
       valid_lft forever preferred_lft forever

Rocky 9是使用NetworkManger来管理了,没有使用network了

在 Rocky Linux 8 中,网络配置的存储位置在 /etc/sysconfig/Network-Scripts/ 中。 在 Rocky Linux 9 中,密钥文件的新默认存储位置在 /etc/NetworkManager/system-connections 中

[root@rocky9-node1 system-connections]# cat eth0.nmconnection
[connection]
id=eth0
uuid=f98a1171-ede5-3a03-8331-2f6089d2136d
type=ethernet
autoconnect-priority=-999
interface-name=eth0
timestamp=1716365444

[ethernet]

[ipv4]
address1=192.168.37.136/24,192.168.37.2
dns=223.5.5.5;114.114.114.114;
method=manual

[ipv6]
addr-gen-mode=eui64
method=auto

[proxy]
[root@rocky9-node1 system-connections]#


还可以通过nmcli命令行和nmtui图形来配置,及通过ip来配置,可以参考 :

https://docs.rockylinux.org/zh/guides/network/basic_network_configuration/

原文链接:Rocky 9 更改网卡名字,转载请注明来源!

0