設定主機名稱
http://www.in-life.idv.tw/index.php?/archives/2005/11/09/C4.html
先要注意 hostname 及 domainname 和 FQDN 之間的差異,簡單的說 FQDN 就是 hostname+domainname
以下假設使用的 ip 是168.95.1.1, hostname 是 test, domainname 是 foo.com.tw,那麼 FQDN 就是 test.foo.com.tw
1. 設定 hostname
修改 /etc/hostname,將內容改為 test
2. 設定 /etc/hosts,一般尚要注意 127.0.0.1,如下是其內容
127.0.0.1 localhost
168.95.1.1 test.foo.com.tw test
3. 使 hostname 生效
# hostname --file /etc/hostname
4. 檢查是否正確
# hostname --fqdn
test.foo.com.tw
這樣就 ok 了,另外要注意的就是 /etc/mailname 這個檔案,通常只有短短的一行,說明著你的 mail 主機名稱,有些 mail 程式會用到,man 的相關資料
The file /etc/mailname is a plain ASCII configuration file, which on a
Debian system contains the visible mail name of the system. It is used
by many different programs, usually programs that wish to send or relay
mail, and need to know the name of the system.
The file contains only one line describing the fully qualified domain
name that the program wishing to get the mail name should use (that is,
everything after the @).
先要注意 hostname 及 domainname 和 FQDN 之間的差異,簡單的說 FQDN 就是 hostname+domainname
以下假設使用的 ip 是168.95.1.1, hostname 是 test, domainname 是 foo.com.tw,那麼 FQDN 就是 test.foo.com.tw
1. 設定 hostname
修改 /etc/hostname,將內容改為 test
2. 設定 /etc/hosts,一般尚要注意 127.0.0.1,如下是其內容
127.0.0.1 localhost
168.95.1.1 test.foo.com.tw test
3. 使 hostname 生效
# hostname --file /etc/hostname
4. 檢查是否正確
# hostname --fqdn
test.foo.com.tw
這樣就 ok 了,另外要注意的就是 /etc/mailname 這個檔案,通常只有短短的一行,說明著你的 mail 主機名稱,有些 mail 程式會用到,man 的相關資料
The file /etc/mailname is a plain ASCII configuration file, which on a
Debian system contains the visible mail name of the system. It is used
by many different programs, usually programs that wish to send or relay
mail, and need to know the name of the system.
The file contains only one line describing the fully qualified domain
name that the program wishing to get the mail name should use (that is,
everything after the @).

0 Comments:
Post a Comment
<< Home