6.7.2.2 /etc/hosts
/etc/hosts 是一个文本数据库。它是用来联合DNS 和NIS 给IP 地址的影射表提供名字。
本地的电脑通过一个LAN 进行连接,可能会作为一个简单的命名目的而放在这儿,以代替设
置一个名称服务器。另外,/etc/hosts 能被用来提供一个本地internet 名称的记录,减少
搜索普通访问名称的需求。
# $FreeBSD$
#
# Host Database
# This file should contain the addresses and aliases
# for local hosts that share this file.
# 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 myname.my.domain
127.0.0.1 localhost localhost.my.domain myname.my.domain
#
第8 页FreeBSD 使用手册
# 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. PLEASE PLEASE PLEASE do not try
# to invent your own network numbers but instead get one from your
# network provider (if any) or from the Internet Registry (ftp to
# rs.internic.net, directory ‘/templates’).
#
/etc/hosts 的简单格式:
[Internet address] [offical hostname] [alias1] [alias2] ...
例如:
10.0.0.1 myRealHostname.foobar.com myRealHostname foobar1 foobar2
第9 页FreeBSD 使用手册
6.7.3 日志文件配置
6.7.3.1 syslog.conf
Syslog.conf 是syslogd 程序的配置文件。它指出记录到日志文件的syslog 信息的类
型。
# $FreeBSD$
#
# Spaces ARE valid field separators in this file. However,
# other *nix-like systems still insist on using tabs as field
# separators. If you are sharing this file between systems, you
# may want to use only tabs as field separators here.
# Consult the syslog.conf manpage.
*.err;kern.debug;auth.notice;mail.crit /dev/console
*.notice;kern.debug;lpr.info;mail.crit;news.err /var/log/messages
security.* /var/log/security
mail.info /var/log/maillog
lpr.info /var/log/lpd-errs
cron.* /var/log/cron
*.err root
*.notice;news.err root
*.alert root
*.emerg *
# uncomment this to log all writes to /dev/console to /var/log/console.log
第10 页FreeBSD 使用手册
#console.info /var/log/console.log
# uncomment this to enable logging of all log messages to /var/log/all.log
#*.* /var/log/all.log
# uncomment this to enable logging to a remote loghost named loghost
#*.* @loghost
# uncomment these if you’re running inn
# news.crit /var/log/news/news.crit
# news.err /var/log/news/news.err
# news.notice /var/log/news/news.notice
!startslip
. /var/log/slip.log
!ppp
. /var/log/ppp.log
6.7.3.2 newsyslog.conf
Newsyslog.conf 是newsyslog 程序的配置文件。一个被cron newsyslog 安排来运行的
程序决定了什么时候日志文件要求重新存档或整理。Logfile 会被改为logfile.1,
logfile.1 会被改为logfile.2 等等。另外,日志文件会用gzip 格式进行存档。它们是这
样命名的:logfiel.0.gz,logfile.1.gz 等等。
Newsyslog.conf 指出了哪个文件需要被管理,有多少需要被保存,什么时候他们会被
调用。当他们达到一定大小或到一个适当的周期时,日志文件需要被重新整理。
# configuration file for newsyslog
# $FreeBSD$
#
第11 页FreeBSD 使用手册
# logfilename [owner:group] mode count size when [ZB] [/pid_file]
[sig_num]
/var/log/cron 600 3 100 * Z
/var/log/amd.log 644 7 100 * Z
/var/log/kerberos.log 644 7 100 * Z
/var/log/lpd-errs 644 7 100 * Z
/var/log/maillog 644 7 * @T00 Z
/var/log/sendmail.st 644 10 * 168 B
/var/log/messages 644 5 100 * Z
/var/log/all.log 600 7 * @T00 Z
/var/log/slip.log 600 3 100 * Z
/var/log/ppp.log 600 3 100 * Z
/var/log/security 600 10 100 * Z
/var/log/wtmp 644 3 * @01T05 B
/var/log/daily.log 640 7 * @T00 Z
/var/log/weekly.log 640 5 1 $W6D0 Z
/var/log/monthly.log 640 12 * $M1D0 Z
/var/log/console.log 640 5 100 * Z
6.7.4 sysctl.conf
第12 页FreeBSD 使用手册
Sysctl.conf 看起来象rc.conf。它的值以这种形式来设置:variable=value。指定的
值需要在进入多用户模式时才能被设置。在这种模式中不是所有的变量都能被设置。
一个sysctl.conf 关闭引起重大错误产生的日志,然后让linux 程序知道他们真的运行
在FreeBSD 下面。
kern.logsigexit=0 # Do not log fatal signal exits (e.g. sig 11)
compat.linux.osname=FreeBSD
compat.linux.osrelease=4.3-STABLE
6.8 用sysctl 进行调整
sysctl 是一个允许你对一个运行着的FreeBSD 系统进行修改的接口。这包括许多TCP/IP
堆栈和虚拟内存系统的高级选项,它通常可以为一个有经验的系统管理员提高系统的性能。
能够使用sysctl 来阅读和设置超过5 百个系统变量。
基于这点,sysctl 起到两个功能:阅读和修改系统设置。去看看所有可读的变量:
% sysctl -a
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




