有數個目錄中儲存著設定資訊,這些目錄有:
/etc | 通用系統特定的設定資訊。 |
/etc/defaults | 系統設定檔的預設版本。 |
/etc/mail | sendmail(8) 額外的設定以及其他 MTA 設定檔。 |
/etc/ppp | user- 及 kernel-ppp 程式的設定。 |
/usr/local/etc | 已安裝應用程式的設定檔,可能會有以應用程式區分的子目錄。 |
/usr/local/etc/rc.d | 已安裝應用程式的 rc(8) Script。 |
/var/db | 自動產生的系統特定資料庫檔案,例如套件資料庫以及 locate(1) 資料庫。 |
FreeBSD 要如何存取網際網路網域名稱系統 (Internet Domain Name System, DNS) 是由 resolv.conf(5) 來控制。
/etc/resolv.conf
中最常用的項目為:
nameserver | 解析程式 (Resolver) 要查詢的名稱伺服器 IP 位置,這些伺服器會依所列的順序來查詢,最多可以有三個。 |
search | 主機名稱查詢使用的搜尋清單。這通常會使用本機主機名稱所在的網域。 |
domain | 本地網域名稱。 |
典型的 /etc/resolv.conf
會如下:
search example.com
nameserver 147.11.1.11
nameserver 147.11.100.30
search
與 domain
選項應擇一使用。
當使用 DHCP 時,dhclient(8) 通常會使用從 DHCP 伺服器所接收到的資訊覆寫 /etc/resolv.conf
。
/etc/hosts
是簡單的文字資料庫,會與 DNS 及 NIS 一併使用來提供主機名稱與 IP 位址的對應。可將透過 LAN 所連結的在地電腦項目加入到這個檔案做最簡單的命名,來替代設定一個 named(8) 伺服器。除此之外 /etc/hosts
可以用來提供本地的網際網路名稱記錄,來減少常用名稱向外部 DNS 伺服器查詢的需求。
# $FreeBSD$
#
#
# Host Database
#
# This file should contain the addresses and aliases for local hosts that
# share this file. Replace 'my.domain' below with the domainname of your
# machine.
#
# In the presence of the domain name service or NIS, this file may
# not be consulted at all; see /etc/nsswitch.conf for the resolution order.
#
#
::1 localhost localhost.my.domain
127.0.0.1 localhost localhost.my.domain
#
# Imaginary network.
#10.0.0.2 myname.my.domain myname
#10.0.0.3 myfriend.my.domain myfriend
#
# According to RFC 1918, you can use the following IP networks for
# private nets which will never be connected to the Internet:
#
# 10.0.0.0 - 10.255.255.255
# 172.16.0.0 - 172.31.255.255
# 192.168.0.0 - 192.168.255.255
#
# In case you want to be able to connect to the Internet, you need
# real official assigned numbers. Do not try to invent your own network
# numbers but instead get one from your network provider (if any) or
# from your regional registry (ARIN, APNIC, LACNIC, RIPE NCC, or AfriNIC.)
#
/etc/hosts
的格式如下:
[Internet address] [official hostname] [alias1] [alias2] ...
例如:
10.0.0.1 myRealHostname.example.com myRealHostname foobar1 foobar2
請參考 hosts(5) 取得更多資訊。
本文及其他文件,可由此下載: ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/。
若有 FreeBSD 方面疑問,請先閱讀
FreeBSD 相關文件,如不能解決的話,再洽詢
<questions@FreeBSD.org>。
關於本文件的問題,請洽詢
<doc@FreeBSD.org>。