Hostname

Main part from: http://www.cpqlinux.com/hostname.html

Checking your Linux host name

First, see if your host name is set correclty using the following commands:
uname -n
hostname -a
hostname -s
hostname -d
hostname -f
hostname
If the above commands return correctly with no errors then all may be well; however, you may want to read on to verify that all settings are correct.
--------------------------------------------------------------------------------------------------------------------------------

Configuring /etc/hosts

If your IP address is assigned to you by a DHCP server, then /etc/hosts is configured as follows:
127.0.0.1	mybox.mydomain.com	localhost.localdomain localhost mybox
If you have a static IP address, then /etc/hosts is configured as follows:
127.0.0.1	localhost.localdomain localhost
192.168.0.10 mybox.mydomain.com mybox
------------------------------------------------------------------------

Setting the Host Name using "hostname"

After updating the /etc/hosts file correctly, the "hostname" command should be run as follows to set your hostname:

hostname mybox.mydomain.com
-------------------------------------------------------------------------------------------------------------------------------

Checking /etc/HOSTNAME (if present)

You may or may not have the file /etc/HOSTNAME:
mybox.mydomain.com
-------------------------------------------------------------------------

Checking /proc/sys/kernel/hostname

This is checked with the following command: cat /proc/sys/kernel/hostname If you need to set this file, you can either reboot or set it now with the following command:

echo mybox.mydomain.com > /proc/sys/kernel/hostname
------------------------------------------------------------------------------------------------------------------------------
It is not reliable to use X tool for my experience.

What is relationship in these files? I will discover in the future.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值