Rocky9.2修改网卡IP地址
通过NetworkManager配置IP地址
开启NetworkManager服务
systemctl start NetworkManager && systemctl enable NetworkManager && systemctl status NetworkManager
打开网卡配置文件,修改ipv4部分代码
vim /etc/NetworkManager/system-connections/ens2f0.nmconnection
[connection]
id=ens2f0
uuid=ae3e634f-ab9d-3e32-b27b-0a73e72ee542
type=ethernet
autoconnect-priority=-999
interface-name=ens2f0
[ethernet]
[ipv4]
method=manual
address1=20.0.2.135/16,20.0.255.254
dns=114.114.114.114
[ipv6]
addr-gen-mode=eui64
method=auto
[proxy]
重新加载网卡配置文件
nmcli connection load /etc/NetworkManager/system-connections/ens2f0.nmconnection
激活网卡配置文件
nmcli connection up /etc/NetworkManager/system-connections/ens2f0.nmconnection