NtpServerOptions Class
Configuration options for NtpServer.
public sealed class NtpServerOptionsConstructors
| Name | Description |
|---|---|
| NtpServerOptions() |
NtpServerOptions()
NtpServerOptions.cspublic NtpServerOptions()No documentation is available.
Properties
| Name | Description |
|---|---|
| AuthenticationKeys | Gets the symmetric keys the server accepts to authenticate requests (RFC 5905, RFC 8573). Default is empty. |
| BindAddress | Gets or sets the address to bind to. Default is IPAddress.Any, which serves every network interface. Use IPAddress.Loopback to serve only the local machine. |
| MaxRequestsPerSecond | Gets or sets the maximum number of requests answered per second per source address. Default is 100. Set to 0 to disable rate limiting. |
| Port | Gets or sets the port to listen on. Default is 0 (auto-assign). |
| ReferenceIdentifier | Gets or sets the reference identifier, up to four ASCII characters. Default is LOCL, the conventional identifier for an undisciplined local clock. |
| RequireAuthentication | Gets or sets a value indicating whether the server ignores the requests that are not authenticated with one of NtpServerOptions.AuthenticationKeys. Default is false. |
| RootDispersion | Gets or sets the maximum error the server advertises for its own clock (the root dispersion). Default is 100 milliseconds. |
| Stratum | Gets or sets the stratum level to advertise. Default is 2. |
| TimeProvider | Gets or sets the time provider used to answer queries. Default is TimeProvider.System. |
AuthenticationKeys
NtpServerOptions.csGets the symmetric keys the server accepts to authenticate requests (RFC 5905, RFC 8573). Default is empty.
public ICollection<NtpAuthenticationKey> AuthenticationKeys { get; }Property value
ICollection<NtpAuthenticationKey>
Remarks
A request that ends with a valid message authentication code (MAC) computed with one of these keys gets a reply authenticated with the same key. A request whose MAC uses an unknown key identifier, or is not valid, gets a crypto-NAK: a reply with no time, that tells the client that the server could not authenticate it.
The key identifiers must be unique. A request without a MAC gets an unauthenticated reply, unless NtpServerOptions.RequireAuthentication is true. The server reads the keys when it is created: later changes to this collection do not apply to it.
BindAddress
NtpServerOptions.csGets or sets the address to bind to. Default is IPAddress.Any, which serves every network interface. Use IPAddress.Loopback to serve only the local machine.
public IPAddress BindAddress { get; set; }Property value
MaxRequestsPerSecond
NtpServerOptions.csGets or sets the maximum number of requests answered per second per source address. Default is 100. Set to 0 to disable rate limiting.
public int MaxRequestsPerSecond { get; set; }Property value
Remarks
The limit is approximate: source addresses are mapped onto a fixed number of buckets so that memory cannot grow with the number of distinct (and easily spoofed) source addresses seen, and colliding addresses share a budget.
Rate limiting is measured against the real system clock rather than NtpServerOptions.TimeProvider, so that a simulated or frozen clock cannot disable it or wedge it permanently.
ReferenceIdentifier
NtpServerOptions.csRequireAuthentication
NtpServerOptions.csGets or sets a value indicating whether the server ignores the requests that are not authenticated with one of NtpServerOptions.AuthenticationKeys. Default is false.
public bool RequireAuthentication { get; set; }Property value
RootDispersion
NtpServerOptions.csGets or sets the maximum error the server advertises for its own clock (the root dispersion). Default is 100 milliseconds.
public TimeSpan RootDispersion { get; set; }Property value
Remarks
Clients use this as the error bound on the offset they compute. Zero claims a perfectly accurate clock, which is never true, so the default is a deliberately conservative bound for an undisciplined software clock. Lower it if the underlying NtpServerOptions.TimeProvider is disciplined and you know its accuracy.
Stratum
NtpServerOptions.csGets or sets the stratum level to advertise. Default is 2.
public byte Stratum { get; set; }Property value
Remarks
Stratum 1 claims a directly attached reference clock such as GPS. A server answering from NtpServerOptions.TimeProvider has no such clock, so the honest value is 2 or higher; set NtpServerOptions.ReferenceIdentifier to match if you do attach one.
TimeProvider
NtpServerOptions.csGets or sets the time provider used to answer queries. Default is TimeProvider.System.
public TimeProvider TimeProvider { get; set; }