markup
[ikiwiki.git] / docs / handbook / handbook-configtuning-configfiles.mdwn
1 ## 6.10 Configuration Files \r
2 ### 6.10.1 /etc Layout \r
3 There are a number of directories in which configuration information is kept. These include:\r
4 [[!table  data="""
5 | `/etc` | Generic system configuration information; data here is system-specific. 
6  `/etc/defaults` | Default versions of system configuration files. 
7  `/etc/mail` | Extra [sendmail(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#sendmail&section8) configuration, other MTA configuration files. 
8  `/etc/ppp` | Configuration for both user- and kernel-ppp programs. 
9  `/etc/namedb` | Default location for [named(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#named&section8) data. Normally `named.conf` and zone files are stored here. 
10  `/usr/local/etc` | Configuration files for installed applications. May contain per-application subdirectories. 
11  `/usr/local/etc/rc.d` | Start/stop scripts for installed applications. 
12  `/var/db` | Automatically generated system-specific database files, such as the package database, the locate database, and so on |\r
13 """]]\r
14 \r
15 ### 6.10.2 Hostnames \r
16 #### 6.10.2.1 /etc/resolv.conf \r
17 `/etc/resolv.conf` dictates how DragonFly's resolver accesses the Internet Domain Name System (DNS).\r
18 \r
19 The most common entries to `resolv.conf` are:\r
20 [[!table  data="""
21 | `nameserver` | The IP address of a name server the resolver should query. The servers are queried in the order listed with a maximum of three. 
22  `search` | Search list for hostname lookup. This is normally determined by the domain of the local hostname. 
23  `domain` | The local domain name. |\r
24 """]]\r
25 \r
26 A typical `resolv.conf`:\r
27 \r
28     \r
29     search example.com\r
30     nameserver 147.11.1.11\r
31     nameserver 147.11.100.30\r
32 \r
33  **Note:** Only one of the `search` and `domain` options should be used.\r
34 \r
35 If you are using DHCP, [dhclient(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#dhclient&section8) usually rewrites `resolv.conf` with information received from the DHCP server.\r
36 \r
37 #### 6.10.2.2 /etc/hosts \r
38 `/etc/hosts` is a simple text database reminiscent of the old Internet. 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 purposes instead of setting up a [named(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#named&section8) server. Additionally, `/etc/hosts` can be used to provide a local record of Internet names, reducing the need to query externally for commonly accessed names.\r
39 \r
40     \r
41     #\r
42     #\r
43     # Host Database\r
44     # This file should contain the addresses and aliases\r
45     # for local hosts that share this file.\r
46     # In the presence of the domain name service or NIS, this file may\r
47     # not be consulted at all; see /etc/nsswitch.conf for the resolution order.\r
48     #\r
49     #\r
50     ::1                     localhost localhost.my.domain myname.my.domain\r
51     127.0.0.1               localhost localhost.my.domain myname.my.domain\r
52     #\r
53     # Imaginary network.\r
54     #10.0.0.2               myname.my.domain myname\r
55     #10.0.0.3               myfriend.my.domain myfriend\r
56     #\r
57     # According to RFC 1918, you can use the following IP networks for\r
58     # private nets which will never be connected to the Internet:\r
59     #\r
60     #       10.0.0.0        -   10.255.255.255\r
61     #       172.16.0.0      -   172.31.255.255\r
62     #       192.168.0.0     -   192.168.255.255\r
63     #\r
64     # In case you want to be able to connect to the Internet, you need\r
65     # real official assigned numbers.  PLEASE PLEASE PLEASE do not try\r
66     # to invent your own network numbers but instead get one from your\r
67     # network provider (if any) or from the Internet Registry (ftp to\r
68     # rs.internic.net, directory `/templates').\r
69     #\r
70 \r
71 `/etc/hosts` takes on the simple format of:\r
72 \r
73     \r
74     [Internet address] [official hostname] [alias1] [alias2] ...\r
75 \r
76 For example:\r
77 \r
78     \r
79     10.0.0.1 myRealHostname.example.com myRealHostname foobar1 foobar2\r
80 \r
81 Consult [hosts(5)](http://leaf.dragonflybsd.org/cgi/web-man?command#hosts&section5) for more information.\r
82 \r
83 ### 6.10.3 Log File Configuration \r
84 #### 6.10.3.1 syslog.conf \r
85 `syslog.conf` is the configuration file for the [syslogd(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#syslogd&section8) program. It indicates which types of `syslog` messages are logged to particular log files.\r
86 \r
87     \r
88     #\r
89     #\r
90     #       Spaces ARE valid field separators in this file. However,\r
91     #       other *nix-like systems still insist on using tabs as field\r
92     #       separators. If you are sharing this file between systems, you\r
93     #       may want to use only tabs as field separators here.\r
94     #       Consult the syslog.conf(5) manual page.\r
95     
96 *.err;kern.debug;auth.notice;mail.crit          /dev/console\r
97     *.notice;kern.debug;lpr.info;mail.crit;news.err /var/log/messages\r
98
99     security.*                                      /var/log/security\r
100     mail.info                                       /var/log/maillog\r
101     lpr.info                                        /var/log/lpd-errs\r
102     cron.*                                          /var/log/cron\r
103     
104 *.err                                           root\r
105     *.notice;news.err                               root\r
106     *.alert                                         root\r
107     *.emerg                                         *\r
108
109     # uncomment this to log all writes to /dev/console to /var/log/console.log\r
110     #console.info                                   /var/log/console.log\r
111     # uncomment this to enable logging of all log messages to /var/log/all.log\r
112     #*.*                                            /var/log/all.log\r
113     # uncomment this to enable logging to a remote log host named loghost\r
114     #*.*                                            @loghost\r
115     # uncomment these if you're running inn\r
116     # news.crit                                     /var/log/news/news.crit\r
117     # news.err                                      /var/log/news/news.err\r
118     # news.notice                                   /var/log/news/news.notice\r
119     !startslip\r
120     
121 *.*                                             /var/log/slip.log\r
122     !ppp\r
123     
124 *.*                                             /var/log/ppp.log\r
125 \r
126 Consult the [syslog.conf(5)](http://leaf.dragonflybsd.org/cgi/web-man?command#syslog.conf&section5) manual page for more information.\r
127 \r
128 #### 6.10.3.2 newsyslog.conf \r
129 `newsyslog.conf` is the configuration file for [newsyslog(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#newsyslog&section8), a program that is normally scheduled to run by [cron(8)](http://leaf.dragonflybsd.org/cgi/web-man?command=cron&section=8). [newsyslog(8)](http://leaf.dragonflybsd.org/cgi/web-man?command=newsyslog&section=8) determines when log files require archiving or rearranging. `logfile` is moved to `logfile.0`, `logfile.0` is moved to `logfile.1`, and so on. Alternatively, the log files may be archived in [gzip(1)](http://leaf.dragonflybsd.org/cgi/web-man?command=gzip&section=1) format causing them to be named: `logfile.0.gz`, `logfile.1.gz`, and so on.\r
130 \r
131 `newsyslog.conf` 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 rearranged and/or archived when they have either reached a certain size, or at a certain periodic time/date.\r
132 \r
133     \r
134     # configuration file for newsyslog\r
135     #\r
136     #\r
137     # filename          [owner:group]    mode count size when [ZB] [/pid_file] [sig_num]\r
138     /var/log/cron                           600  3     100  *     Z\r
139     /var/log/amd.log                        644  7     100  *     Z\r
140     /var/log/kerberos.log                   644  7     100  *     Z\r
141     /var/log/lpd-errs                       644  7     100  *     Z\r
142     /var/log/maillog                        644  7     *    @T00  Z\r
143     /var/log/sendmail.st                    644  10    *    168   B\r
144     /var/log/messages                       644  5     100  *     Z\r
145     /var/log/all.log                        600  7     *    @T00  Z\r
146     /var/log/slip.log                       600  3     100  *     Z\r
147     /var/log/ppp.log                        600  3     100  *     Z\r
148     /var/log/security                       600  10    100  *     Z\r
149     /var/log/wtmp                           644  3     *    @01T05 B\r
150     /var/log/daily.log                      640  7     *    @T00  Z\r
151     /var/log/weekly.log                     640  5     1    $W6D0 Z\r
152     /var/log/monthly.log                    640  12    *    $M1D0 Z\r
153     /var/log/console.log                    640  5     100  *     Z\r
154 \r
155 Consult the [newsyslog(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#newsyslog&section8) manual page for more information.\r
156 \r
157 ### 6.10.4 sysctl.conf \r
158 `sysctl.conf` looks much like `rc.conf`. Values are set in a `variable=value` form. The specified values are set after the system goes into multi-user mode. Not all variables are settable in this mode.\r
159 \r
160 A sample `sysctl.conf` turning off logging of fatal signal exits and letting Linux programs know they are really running under DragonFly:\r
161 \r
162     \r
163     kern.logsigexit=0       # Do not log fatal signal exits (e.g. sig 11)\r
164     compat.linux.osname=DragonFly\r
165     compat.linux.osrelease=4.3-STABLE\r
166 \r