centos7 固定hostname 和 ip地址

服务器使用centos7

1、固定hostname(服务器重启后不变)

当前hostname为h101

修改 /etc/hostname  文件内的h101 为 h102

保存退出后:输入hostname:

备注:需重启后生效(命令:$>hostname)

2、固定ip

查看当前ip

为192.168.44.101  和  192.168.44.152(虚拟机自行分配)

进入以下目录

进入对应的文件修改对应的ip

修改这个属性值为 192.168.44.102

再次查看发现并未修改过来,注意得重启后才能生效(命令:$>reboot)

重启后查看:

猜你喜欢

转载自blog.csdn.net/weixin_39435629/article/details/84861344