Supported Platforms
Tracing Extended DHCP Operations
Both the extended DHCP local server and the extended DHCP relay agent support tracing operations. DHCP tracing operations track extended DHCP operations and record them in a log file. The error descriptions captured in the log file provide detailed information to help you solve problems.
You can configure DHCP trace operations at the global level and at the interface level. Global DHCP tracing logs all DHCP-related events, whereas interface-level tracing logs only interface-specific DHCP events. If you configure interface-level trace operations, you can specify tracing for a range of interfaces or an individual interface. However, only a single interface-level log file is supported. That is, you cannot specify different interface-level log files for different interfaces or groups of interfaces.
By default, nothing is traced. When you enable the tracing operation, the default tracing behavior is as follows:
- Important events for both global and per-interface tracing are logged in a file located in the /var/log directory. By default, the router uses the filename, jdhcpd. You can specify a different filename, but you cannot change the directory in which trace files are located.
- When the trace log file filename reaches 128 kilobytes (KB), it is compressed and renamed filename.0.gz. Subsequent events are logged
in a new file called filename, until
it reaches capacity again. At this point, filename.0.gz is renamed filename.1.gz and filename is compressed and renamed filename.0.gz. This process repeats until
the number of archived files reaches the maximum file number. Then
the oldest trace file—the one with the highest number—is
overwritten.
You can optionally specify the number of trace files to be from 2 through 1000. You can also configure the maximum file size to be from 10 KB through 1 gigabyte (GB). (For more information about how log files are created, see the Junos OS System Log Messages Reference.)
- By default, only the user who configures the tracing operation can access log files. You can optionally configure read-only access for all users.
To configure global DHCP tracing operations.
- Specify tracing operations for DHCP local server and DHCP
relay:[edit system processes dhcp-service]user@host# edit traceoptions
The tracing configuration is applied globally to all DHCP applications in every LS:RI. Configuration of event tracing on a per-LS:RI basis is not supported. DHCP tracing is configurable only in the default LS:RI. However, DHCP applications (local server or relay) do not have be configured in the default LS:RI. This behavior was different in software releases before Junos OS Release 11.4, where you had to configure a DHCP application in the default LS:RI in order to configure DHCP tracing, even when you wanted to run DHCP and trace its operations only in a nondefault LS:RI.
In the earlier software releases, you configured tracing statements at the [edit system services dhcp-local-server] and [edit forwarding-options dhcp-relay] hierarchy levels. These statements have been deprecated and hidden in favor of the statements at the [edit system processes dhcp-service] hierarchy level.
![]() | Note: The deprecated statements may be removed from a future release; we recommend that you transition to the new statements. |
Because you can configure DHCP tracing at three different hierarchy levels (one new and recommended, two old and deprecated), the following rules apply to manage the interaction:
- When you configure a filename or any other options for the trace log file, the configuration at the [edit system processes dhcp-service] hierarchy level has the highest precedence, followed by the configuration at the [edit system services dhcp-local-server] hierarchy level, and finally with the lowest precedence, the configuration at the [edit forwarding-options dhcp-relay] hierarchy level.
- The flag configurations for multiple hierarchy levels are merged and applied to all trace log events.
- The deprecated statements do not support filtering the generation of DHCP trace log events by severity level. If you use these statements, trace logging operates with an implicit severity of all, regardless of the severity level configured at the [edit system processes dhcp-service] hierarchy level.
For information about configuring per-interface tracing options, see Tracing Extended DHCP Operations for Specific Interfaces.
The extended DHCP traceoptions operations are described in the following sections:
- Configuring the Extended DHCP Log Filename
- Configuring the Number and Size of Extended DHCP Log Files
- Configuring Access to the Extended DHCP Log File
- Configuring a Regular Expression for Extended DHCP Messages to Be Logged
- Configuring the Extended DHCP Tracing Flags
- Configuring the Severity Level to Filter Which Extended DHCP Messages Are Logged
- Tracing Extended DHCP Operations for Specific Interfaces
Configuring the Extended DHCP Log Filename
By default, the name of the file that records trace output is jdhcpd. You can specify a different name by including the file option. DHCP local server and DHCP relay agent both support the file option for the traceoptions statement and the interface-traceoptions statement.
To change the filename:
- Specify a filename for global tracing operations.[edit system processes dhcp-service traceoptions]user@host# set file filename
- Specify a filename for per-interface tracing operations.[edit system processes dhcp-service interface-traceoptions]user@host# set file filename
Configuring the Number and Size of Extended DHCP Log Files
You can optionally specify the number of compressed, archived trace log files to be from 2 through 1000. You can also configure the maximum file size to be from 10 KB through 1 gigabyte (GB); the default size is 128 kilobytes (KB).
The archived files are differentiated by a suffix in the format .number.gz. The newest archived file is .0.gz and the oldest archived file is .(maximum number)-1.gz. When the current trace log file reaches the maximum size, it is compressed and renamed, and any existing archived files are renamed. This process repeats until the maximum number of archived files is reached, at which point the oldest file is overwritten.
For example, you can set the maximum file size to 2 MB, and the maximum number of files to 20. When the file that receives the output of the tracing operation, filename, reaches 2 MB, filename is compressed and renamed filename.0.gz, and a new file called filename is created. When the new filename reaches 2 MB, filename.0.gz is renamed filename.1.gz and filename is compressed and renamed filename.0.gz. This process repeats until there are 20 trace files. Then the oldest file, filename.19.gz, is simply overwritten when the next oldest file, filename.18.gz is compressed and renamed to filename.19.gz.
DHCP local server and DHCP relay agent both support the files and size options for the traceoptions statement and the interface-traceoptions statement. To configure the number and size of trace files:
- Specify the name, number, and size of the file used for
the trace output for global tracing operations.[edit system processes dhcp-service traceoptions]user@host# set file filename files number size maximum-file-size
- Specify the name, number, and size of the file used for
the trace output for per-interface tracing operations.[edit system processes dhcp-service interface-traceoptions]user@host# set file filename files number size maximum-file-size
Configuring Access to the Extended DHCP Log File
By default, only the user who configures the tracing operation can access the log files. You can enable all users to read the log file and you can explicitly set the default behavior of the log file.
DHCP local server and DHCP relay agent both support the world-readable option and the no-world-readable option for the traceoptions statement and the interface-traceoptions statement. To specify that all users can read the log file:
- Configure the log file to be world-readable for global
tracing operations.[edit system processes dhcp-service traceoptions]user@host# set file filename world-readable
- Configure the log file to be world-readable for per-interface
tracing operations.[edit system processes dhcp-service interface-traceoptions]user@host# set file filename world-readable
To explicitly set the default behavior, in which the log file can only be read by the user who configured tracing:
- Configure the log file to be no-world-readable for global
tracing operations.[edit system processes dhcp-service traceoptions]user@host# set file filename no-world-readable
- Configure the log file to be no-world-readable for per-interface
tracing operations.[edit system processes dhcp-service interface-traceoptions]user@host# set file filename no-world-readable
Configuring a Regular Expression for Extended DHCP Messages to Be Logged
By default, the trace operation output includes all messages relevant to the logged events. You can refine the output by including regular expressions to be matched.
DHCP local server and DHCP relay agent both support the match option for the traceoptions statement and the interface-traceoptions statement. To configure regular expressions to be matched:
- Specify the regular expression for global tracing operations.[edit system processes dhcp-service traceoptions]user@host# set file filename match regular-expression
- Specify the regular expression for per-interface tracing
operations.[edit system processes dhcp-service interface-traceoptions]user@host# set file filename match regular-expression
Configuring the Extended DHCP Tracing Flags
By default, only important events are logged. You can specify which events and operations are logged by specifying one or more tracing flags.
DHCP local server and DHCP relay agent both support the flag option for the traceoptions statement and the interface-traceoptions statement. A smaller set of flags is supported for interface-level tracing than for global tracing. To configure the flags for the events to be logged:
- Specify the flags for global tracing operations.[edit system processes dhcp-service traceoptions]user@host# set flag flag
- Specify the flags for per-interface tracing operations.[edit system processes dhcp-service interface-traceoptions]user@host# set flag flag
Configuring the Severity Level to Filter Which Extended DHCP Messages Are Logged
The messages associated with a logged event are categorized according to severity level. You can use the severity level to determine which messages are logged for the event type. A low severity level is less restrictive—filters out fewer messages—than a higher level. When you configure a severity level, all messages at that level and all higher (more restrictive) levels are logged.
The following list presents severity levels in order from lowest (least restrictive) to highest (most restrictive). This order also represents the significance of the messages; for example, error messages are of greater concern than info messages.
- verbose
- info
- notice
- warning
- error
The severity level that you configure depends on the issue that you are trying to resolve. In some cases you might be interested in seeing all messages relevant to the logged event, so you specify all. You can also specify verbose with the same result, because verbose is the lowest (least restrictive) severity level; it has nothing to do with the terseness or verbosity of the messages. Either choice generates a large amount of output. You can specify a more restrictive severity level, such as notice or info to filter the messages. By default, the trace operation output includes only messages with a severity level of error.
DHCP local server and DHCP relay agent both support the level option for the traceoptions statement and the interface-traceoptions statement. To configure the flags for the events to be logged:
- Specify the severity level for global tracing operations.[edit system processes dhcp-service traceoptions]user@host# set level severity
- Specify the severity level for per-interface tracing operations.[edit system processes dhcp-service interface-traceoptions]user@host# set level severity
Tracing Extended DHCP Operations for Specific Interfaces
In addition to the global DHCP tracing operations, subscriber management enables you to trace extended DHCP operations for a specific interface or for a range of interfaces.
Configuring per-interface tracing is a two-step procedure. In the first step, you specify the tracing options that you want to use, such as file information and flags. In the second step, you enable the tracing operation on the specific interfaces.
To configure per-interface tracing operations:
- Specify the tracing options you want to use.
Note: Per-interface tracing uses the same default tracing behavior as the global extended DHCP tracing operation. The default behavior is described in Tracing Extended DHCP Operations.
- Specify that you want to configure per-interface tracing
options.
- For DHCP local server, DHCPv6 local server, DHCP relay
agent, and DHCPv6 relay agent:[edit system processes dhcp-service]user@host# edit interface-traceoptions
- For DHCP local server, DHCPv6 local server, DHCP relay
agent, and DHCPv6 relay agent:
- (Optional) Specify the tracing file options.
- Configure the name for the file used for the trace output.
- Configure the number and size of the log files.
See Configuring the Number and Size of Extended DHCP Log Files.
- Configure access to the log file.
- Configure a regular expression to filter logging events.
See Configuring a Regular Expression for Extended DHCP Messages to Be Logged.
- (Optional) Specify tracing flag options.
- (Optional) Configure a severity level for messages to
specify which event messages are logged.
See Configuring the Severity Level to Filter Which Extended DHCP Messages Are Logged.
- Specify that you want to configure per-interface tracing
options.
- Enable tracing on an interface or interface range.
The following examples show a DHCP local server configuration. You can also use the trace statement at the [edit forwarding-options dhcp-relay] hierarchy level and at the [edit system services dhcp-local-server dhcpv6] hierarchy level.
- Enable tracing on a specific interface.[edit system services dhcp-local-server]user@host# set group group-name interface interface-name trace
- Enable tracing on a range of interfaces.[edit system services dhcp-local-server]user@host# set group group-name interface interface-name upto interface interface-name trace
- Enable tracing on a specific interface.