Lines 56-62
This chapter explains much of the FreeBSD configuration process, including some
Link Here
|
56 |
|
56 |
|
57 |
After reading this chapter, you will know: |
57 |
After reading this chapter, you will know: |
58 |
|
58 |
|
59 |
* The basics of [.filename]#rc.conf# configuration and [.filename]#/usr/local/etc/rc.d# startup scripts. |
59 |
* The basics of [.filename]#rc.conf# configuration with man:sysrc[8] and [.filename]#/usr/local/etc/rc.d# startup scripts. |
60 |
* How to configure and test a network card. |
60 |
* How to configure and test a network card. |
61 |
* How to configure virtual hosts on network devices. |
61 |
* How to configure virtual hosts on network devices. |
62 |
* How to use the various configuration files in [.filename]#/etc#. |
62 |
* How to use the various configuration files in [.filename]#/etc#. |
Lines 80-86
In FreeBSD, most included services, such as man:cron[8], are started through the
Link Here
|
80 |
=== Extended Application Configuration |
80 |
=== Extended Application Configuration |
81 |
|
81 |
|
82 |
Now that FreeBSD includes [.filename]#rc.d#, configuration of application startup is easier and provides more features. |
82 |
Now that FreeBSD includes [.filename]#rc.d#, configuration of application startup is easier and provides more features. |
83 |
Using the key words discussed in <<configtuning-rcd>>, applications can be set to start after certain other services and extra flags can be passed through [.filename]#/etc/rc.conf# in place of hard coded flags in the startup script. |
83 |
Using the key words discussed in <<configtuning-rcd>>, applications can be set to start after certain other services and extra flags can be passed through man:sysrc[8] in place of hard coded flags in the startup script. |
84 |
A basic script may look similar to the following: |
84 |
A basic script may look similar to the following: |
85 |
|
85 |
|
86 |
[.programlisting] |
86 |
[.programlisting] |
Lines 113-126
run_rc_command "$1"
Link Here
|
113 |
This script will ensure that the provided `utility` will be started after the `DAEMON` pseudo-service. |
113 |
This script will ensure that the provided `utility` will be started after the `DAEMON` pseudo-service. |
114 |
It also provides a method for setting and tracking the process ID (PID). |
114 |
It also provides a method for setting and tracking the process ID (PID). |
115 |
|
115 |
|
116 |
This application could then have the following line placed in [.filename]#/etc/rc.conf#: |
116 |
This application could then be enabled with man:sysrc[8]: |
117 |
|
117 |
|
118 |
[.programlisting] |
118 |
[.programlisting] |
119 |
.... |
119 |
.... |
120 |
utility_enable="YES" |
120 |
sysrc utility_enable="YES" |
121 |
.... |
121 |
.... |
122 |
|
122 |
|
123 |
This method allows for easier manipulation of command line arguments, inclusion of the default functions provided in [.filename]#/etc/rc.subr#, compatibility with man:rcorder[8], and provides for easier configuration via [.filename]#rc.conf#. |
123 |
This method allows for easier manipulation of command line arguments, inclusion of the default functions provided in [.filename]#/etc/rc.subr#, compatibility with man:rcorder[8], and provides for easier configuration via man:sysrc[8]. |
124 |
|
124 |
|
125 |
=== Using Services to Start Services |
125 |
=== Using Services to Start Services |
126 |
|
126 |
|
Lines 255-265
For instance, man:sshd[8] can be restarted with the following command:
Link Here
|
255 |
|
255 |
|
256 |
This procedure can be used to start services on a running system. |
256 |
This procedure can be used to start services on a running system. |
257 |
Services will be started automatically at boot time as specified in man:rc.conf[5]. |
257 |
Services will be started automatically at boot time as specified in man:rc.conf[5]. |
258 |
For example, to enable man:natd[8] at system startup, add the following line to [.filename]#/etc/rc.conf#: |
258 |
For example, to enable man:natd[8] at system startup, use man:sysrc[8]: |
259 |
|
259 |
|
260 |
[.programlisting] |
260 |
[.programlisting] |
261 |
.... |
261 |
.... |
262 |
natd_enable="YES" |
262 |
sysrc natd_enable="YES" |
263 |
.... |
263 |
.... |
264 |
|
264 |
|
265 |
If a `natd_enable="NO"` line is already present, change the `NO` to `YES`. |
265 |
If a `natd_enable="NO"` line is already present, change the `NO` to `YES`. |
Lines 561-572
dc0: flags=8843<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
Link Here
|
561 |
it would indicate the card has not been configured. |
561 |
it would indicate the card has not been configured. |
562 |
|
562 |
|
563 |
The card must be configured as `root`. |
563 |
The card must be configured as `root`. |
564 |
The NIC configuration can be performed from the command line with man:ifconfig[8] but will not persist after a reboot unless the configuration is also added to [.filename]#/etc/rc.conf#. |
564 |
The NIC configuration can be performed from the command line with man:ifconfig[8] but will not persist after a reboot unless the configuration is also modified with man:sysrc[8]. |
565 |
If a DHCP server is present on the LAN, just add this line: |
565 |
If a DHCP server is present on the LAN, just add this line: |
566 |
|
566 |
|
567 |
[.programlisting] |
567 |
[.programlisting] |
568 |
.... |
568 |
.... |
569 |
ifconfig_dc0="DHCP" |
569 |
sysrc ifconfig_dc0="DHCP" |
570 |
.... |
570 |
.... |
571 |
|
571 |
|
572 |
Replace _dc0_ with the correct value for the system. |
572 |
Replace _dc0_ with the correct value for the system. |
Lines 948-959
This example adds the hostname of `B`, logs all facilities, and stores the log e
Link Here
|
948 |
When adding multiple log clients, add a similar two-line entry for each client. |
948 |
When adding multiple log clients, add a similar two-line entry for each client. |
949 |
More information about the available facilities may be found in man:syslog.conf[5]. |
949 |
More information about the available facilities may be found in man:syslog.conf[5]. |
950 |
|
950 |
|
951 |
Next, configure [.filename]#/etc/rc.conf#: |
951 |
Next, configure with man:sysrc[8]: |
952 |
|
952 |
|
953 |
[.programlisting] |
953 |
[.programlisting] |
954 |
.... |
954 |
.... |
955 |
syslogd_enable="YES" |
955 |
sysrc syslogd_enable="YES" |
956 |
syslogd_flags="-a logclient.example.com -v -v" |
956 |
sysrc syslogd_flags="-a logclient.example.com -v -v" |
957 |
.... |
957 |
.... |
958 |
|
958 |
|
959 |
The first entry starts syslogd at system boot. |
959 |
The first entry starts syslogd at system boot. |
Lines 988-999
If the server did not restart, consult [.filename]#/var/log/messages# for the er
Link Here
|
988 |
A logging client sends log entries to a logging server on the network. |
988 |
A logging client sends log entries to a logging server on the network. |
989 |
The client also keeps a local copy of its own logs. |
989 |
The client also keeps a local copy of its own logs. |
990 |
|
990 |
|
991 |
Once a logging server has been configured, edit [.filename]#/etc/rc.conf# on the logging client: |
991 |
Once a logging server has been configured, use man:sysrc[8] to enable the logging client: |
992 |
|
992 |
|
993 |
[.programlisting] |
993 |
[.programlisting] |
994 |
.... |
994 |
.... |
995 |
syslogd_enable="YES" |
995 |
sysrc syslogd_enable="YES" |
996 |
syslogd_flags="-s -v -v" |
996 |
sysrc syslogd_flags="-s -v -v" |
997 |
.... |
997 |
.... |
998 |
|
998 |
|
999 |
The first entry enables syslogd on boot up. |
999 |
The first entry enables syslogd on boot up. |