HOSTNAME
比如改成机器的IP:
GATEWAY=10.20.150.254
改完后运行/etc/rc.d/rc.sysinit
系统运行如下:
最后输入密码退出,不会重启,这个时候hostname 就修改完毕了
当然运行reboot也可以
Temporarily changing your hostname
You can temporarily change your hostname by issuing a single command. You have to issue this command either using sudo or as the root user. To make this change you will use the same command you used to find out your hostname, only you will include the new hostname to the command. Say you want to change your hostname to “willow”. To make this change temporarily issue the command:
hostname willow
Now issue the command hostname which should report back:
willow
This change will last until you reboot your machine.
Permanently changing your hostname
How you permanently change your hostname will depending upon which distribution you use. We’ll examine making this change on both a Ubuntu system and a Fedora system. First Ubuntu.
On a Ubuntu system there is a file called /etc/hostname. The contents of this file will have a single line containing the hostname of your machine. Open up this file in your favorite editor, delete the default hostname, add your desired hostname, and save the file. To make this chang take effect issue the command:
/etc/init.d/hostname.sh start
This hostname will remain intact upon reboot.
Now to change your hostname in Fedora. This is taken care of in the /etc/sysconfig/networkfile. The default contents of this file will look like:
NETWORKING=yes
HOSTNAME=localhost.localdomain
Erase the “localhost.localdomain” portion and change that to reflect the hostname you want. Once you have made this change save the file. Once you have made this change issue the following command (as the root user):
/etc/rc.d/rc.sysinit
For the change to take effect.