1:修改hostname
vi /etc/hostname
修改成你想要的名字即可
2:修改hosts
[root@ycloud2-test-s3 ~]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
在后面增加Ip hostname即可
修改后需要重启网络设置
1:重启服务器
2:使用命令重启网络设置
[root@v2x-preprod-service-ecs-02 ~]# service network restart
或者命令
[root@v2x-preprod-service-ecs-02 ~]# /etc/init.d/network restart
如果启动网络设置出现如下错误
Restarting network (via systemctl): Job for network.service failed because the control
process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.
[FAILED]
查看网络状态
[root@v2x-preprod-service-ecs-02 network-scripts]# systemctl status network