[root@localhost network-scripts]# cd /etc/NetworkManager/system-connections/
[root@localhost system-connections]# ls
ens160.nmconnection
[root@localhost system-connections]# cat ens160.nmconnection
[connection]
id=ens160
uuid=0c6858f7-2c09-3cb6-a914-72116c47c967
type=ethernet
autoconnect-priority=-999
interface-name=ens160
timestamp=1705951557
[ethernet]
[ipv4]
#method=auto
address1=10.50.14X.X/24,10.50.149.1
dns=10.50.149.1;223.5.5.5
method=manual
[ipv6]
addr-gen-mode=eui64
method=auto
[proxy]
[root@localhost system-connections]# ls
重启网卡,配置生效
# nmcli c reload
# nmcli c up ens160
# ip a
#获取当前主机名,也可以使用hostname
nmcli general hostname
#设置新主机名称
nmcli general hostname XXXX.com