⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 configtuning-configfiles.html

📁 FreeBSD操作系统的详细使用手册
💻 HTML
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta name="generator" content="HTML Tidy, see www.w3.org" /><title>Configuration Files</title><meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" /><link rel="HOME" title="FreeBSD Handbook" href="index.html" /><link rel="UP" title="Configuration and Tuning" href="config-tuning.html" /><link rel="PREVIOUS" title="Virtual Hosts" href="configtuning-virtual-hosts.html" /><link rel="NEXT" title="Tuning with sysctl" href="configtuning-sysctl.html" /><link rel="STYLESHEET" type="text/css" href="docbook.css" /></head><body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"alink="#0000FF"><div class="NAVHEADER"><table summary="Header navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><th colspan="3" align="center">FreeBSD Handbook</th></tr><tr><td width="10%" align="left" valign="bottom"><a href="configtuning-virtual-hosts.html"accesskey="P">Prev</a></td><td width="80%" align="center" valign="bottom">Chapter 11 Configuration and Tuning</td><td width="10%" align="right" valign="bottom"><a href="configtuning-sysctl.html"accesskey="N">Next</a></td></tr></table><hr align="LEFT" width="100%" /></div><div class="SECT1"><h1 class="SECT1"><a id="CONFIGTUNING-CONFIGFILES" name="CONFIGTUNING-CONFIGFILES">11.10Configuration Files</a></h1><div class="SECT2"><h2 class="SECT2"><a id="AEN16308" name="AEN16308">11.10.1 <tt class="FILENAME">/etc</tt>Layout</a></h2><p>There are a number of directories in which configuration information is kept. Theseinclude:</p><div class="INFORMALTABLE"><a id="AEN16312" name="AEN16312"></a><table border="0" frame="void" class="CALSTABLE"><col width="1*" /><col width="2*" /><tbody><tr><td><tt class="FILENAME">/etc</tt></td><td>Generic system configuration information; data here is system-specific.</td></tr><tr><td><tt class="FILENAME">/etc/defaults</tt></td><td>Default versions of system configuration files.</td></tr><tr><td><tt class="FILENAME">/etc/mail</tt></td><td>Extra <a href="http://www.FreeBSD.org/cgi/man.cgi?query=sendmail&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">sendmail</span>(8)</span></a>configuration, other MTA configuration files.</td></tr><tr><td><tt class="FILENAME">/etc/ppp</tt></td><td>Configuration for both user- and kernel-ppp programs.</td></tr><tr><td><tt class="FILENAME">/etc/namedb</tt></td><td>Default location for <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=named&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">named</span>(8)</span></a> data.Normally <tt class="FILENAME">named.conf</tt> and zone files are stored here.</td></tr><tr><td><tt class="FILENAME">/usr/local/etc</tt></td><td>Configuration files for installed applications. May contain per-applicationsubdirectories.</td></tr><tr><td><tt class="FILENAME">/usr/local/etc/rc.d</tt></td><td>Start/stop scripts for installed applications.</td></tr><tr><td><tt class="FILENAME">/var/db</tt></td><td>Automatically generated system-specific database files, such as the package database,the locate database, and so on</td></tr></tbody></table></div></div><div class="SECT2"><h2 class="SECT2"><a id="AEN16356" name="AEN16356">11.10.2 Hostnames</a></h2><div class="SECT3"><h3 class="SECT3"><a id="AEN16362" name="AEN16362">11.10.2.1 <ttclass="FILENAME">/etc/resolv.conf</tt></a></h3><p><tt class="FILENAME">/etc/resolv.conf</tt> dictates how FreeBSD's resolver accessesthe Internet Domain Name System (DNS).</p><p>The most common entries to <tt class="FILENAME">resolv.conf</tt> are:</p><div class="INFORMALTABLE"><a id="AEN16372" name="AEN16372"></a><table border="0" frame="void" class="CALSTABLE"><col width="1*" /><col width="2*" /><tbody><tr><td><var class="LITERAL">nameserver</var></td><td>The IP address of a name server the resolver should query. The servers are queried inthe order listed with a maximum of three.</td></tr><tr><td><var class="LITERAL">search</var></td><td>Search list for hostname lookup. This is normally determined by the domain of thelocal hostname.</td></tr><tr><td><var class="LITERAL">domain</var></td><td>The local domain name.</td></tr></tbody></table></div><p>A typical <tt class="FILENAME">resolv.conf</tt>:</p><pre class="PROGRAMLISTING">search example.comnameserver 147.11.1.11nameserver 147.11.100.30</pre><div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> Only one of the <var class="LITERAL">search</var> and <varclass="LITERAL">domain</var> options should be used.</p></blockquote></div><p>If you are using DHCP, <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=dhclient&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">dhclient</span>(8)</span></a> usuallyrewrites <tt class="FILENAME">resolv.conf</tt> with information received from the DHCPserver.</p></div><div class="SECT3"><h3 class="SECT3"><a id="AEN16401" name="AEN16401">11.10.2.2 <ttclass="FILENAME">/etc/hosts</tt></a></h3><p><tt class="FILENAME">/etc/hosts</tt> is a simple text database reminiscent of the oldInternet. It works in conjunction with DNS and NIS providing name to IP address mappings.Local computers connected via a LAN can be placed in here for simplistic naming purposesinstead of setting up a <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=named&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">named</span>(8)</span></a> server.Additionally, <tt class="FILENAME">/etc/hosts</tt> can be used to provide a local recordof Internet names, reducing the need to query externally for commonly accessed names.</p><pre class="PROGRAMLISTING"># $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.domain127.0.0.1               localhost localhost.my.domain myname.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.  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').#</pre><p><tt class="FILENAME">/etc/hosts</tt> takes on the simple format of:</p><pre class="PROGRAMLISTING">[Internet address] [official hostname] [alias1] [alias2] ...</pre><p>For example:</p><pre class="PROGRAMLISTING">10.0.0.1 myRealHostname.example.com myRealHostname foobar1 foobar2</pre><p>Consult <a href="http://www.FreeBSD.org/cgi/man.cgi?query=hosts&sektion=5"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">hosts</span>(5)</span></a> for moreinformation.</p></div></div><div class="SECT2"><h2 class="SECT2"><a id="AEN16422" name="AEN16422">11.10.3 Log FileConfiguration</a></h2><div class="SECT3"><h3 class="SECT3"><a id="AEN16426" name="AEN16426">11.10.3.1 <ttclass="FILENAME">syslog.conf</tt></a></h3><p><tt class="FILENAME">syslog.conf</tt> is the configuration file for the <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=syslogd&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">syslogd</span>(8)</span></a> program. Itindicates which types of <tt class="COMMAND">syslog</tt> messages are logged toparticular log files.</p><pre class="PROGRAMLISTING"># $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(5) manual page.*.err;kern.debug;auth.notice;mail.crit          /dev/console*.notice;kern.debug;lpr.info;mail.crit;news.err /var/log/messagessecurity.*                                      /var/log/securitymail.info                                       /var/log/mailloglpr.info                                        /var/log/lpd-errscron.*                                          /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#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 log host 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</pre><p>Consult the <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=syslog.conf&sektion=5"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">syslog.conf</span>(5)</span></a> manualpage for more information.</p></div><div class="SECT3"><h3 class="SECT3"><a id="AEN16442" name="AEN16442">11.10.3.2 <ttclass="FILENAME">newsyslog.conf</tt></a></h3><p><tt class="FILENAME">newsyslog.conf</tt> is the configuration file for <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=newsyslog&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">newsyslog</span>(8)</span></a>, aprogram that is normally scheduled to run by <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=cron&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">cron</span>(8)</span></a>. <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=newsyslog&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">newsyslog</span>(8)</span></a>determines when log files require archiving or rearranging. <ttclass="FILENAME">logfile</tt> is moved to <tt class="FILENAME">logfile.0</tt>, <ttclass="FILENAME">logfile.0</tt> is moved to <tt class="FILENAME">logfile.1</tt>, and soon. Alternatively, the log files may be archived in <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=gzip&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">gzip</span>(1)</span></a> format causingthem to be named: <tt class="FILENAME">logfile.0.gz</tt>, <ttclass="FILENAME">logfile.1.gz</tt>, and so on.</p><p><tt class="FILENAME">newsyslog.conf</tt> indicates which log files are to be managed,how many are to be kept, and when they are to be touched. Log files can be rearrangedand/or archived when they have either reached a certain size, or at a certain periodictime/date.</p><pre class="PROGRAMLISTING"># configuration file for newsyslog# $FreeBSD$## filename          [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</pre><p>Consult the <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=newsyslog&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">newsyslog</span>(8)</span></a> manualpage for more information.</p></div></div><div class="SECT2"><h2 class="SECT2"><a id="CONFIGTUNING-SYSCTLCONF" name="CONFIGTUNING-SYSCTLCONF">11.10.4<tt class="FILENAME">sysctl.conf</tt></a></h2><p><tt class="FILENAME">sysctl.conf</tt> looks much like <ttclass="FILENAME">rc.conf</tt>. Values are set in a <varclass="LITERAL">variable=value</var> form. The specified values are set after the systemgoes into multi-user mode. Not all variables are settable in this mode.</p><p>A sample <tt class="FILENAME">sysctl.conf</tt> turning off logging of fatal signalexits and letting Linux programs know they are really running under FreeBSD:</p><pre class="PROGRAMLISTING">kern.logsigexit=0       # Do not log fatal signal exits (e.g. sig 11)compat.linux.osname=FreeBSDcompat.linux.osrelease=4.3-STABLE</pre></div></div><div class="NAVFOOTER"><hr align="LEFT" width="100%" /><table summary="Footer navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><td width="33%" align="left" valign="top"><a href="configtuning-virtual-hosts.html"accesskey="P">Prev</a></td><td width="34%" align="center" valign="top"><a href="index.html"accesskey="H">Home</a></td><td width="33%" align="right" valign="top"><a href="configtuning-sysctl.html"accesskey="N">Next</a></td></tr><tr><td width="33%" align="left" valign="top">Virtual Hosts</td><td width="34%" align="center" valign="top"><a href="config-tuning.html"accesskey="U">Up</a></td><td width="33%" align="right" valign="top">Tuning with sysctl</td></tr></table></div><p align="center"><small>This, and other documents, can be downloaded from <ahref="ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/">ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/</a>.</small></p><p align="center"><small>For questions about FreeBSD, read the <ahref="http://www.FreeBSD.org/docs.html">documentation</a> before contacting &#60;<ahref="mailto:questions@FreeBSD.org">questions@FreeBSD.org</a>&#62;.<br />For questions about this documentation, e-mail &#60;<ahref="mailto:doc@FreeBSD.org">doc@FreeBSD.org</a>&#62;.</small></p></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -