OpenBSD Handbook

    Theme
    • Part I. Install & Configure
      • Introduction to OpenBSD
      • Installing OpenBSD
      • The X Window System
      • Networking on OpenBSD
      • System Configuration
      • OpenBSD Basics
      • Managing Software: Packages and Ports
    • Part II. Daily Operations
      • OpenBSD Desktop Environments
      • Multimedia
      • Printing
      • Linux Compatibility
      • Windows Compatibility
      • Games
    • Part III. System Administration
      • Virtualization
      • Storage and File Systems
      • Updating and Upgrading
      • Localization
      • The OpenBSD Boot Process
      • Security
    • Part IV. Networking & Daemons
      • Services
        • Database
          • MariaDB
          • PostgreSQL
          • Redis
          • memcached
        • Directory
          • YP (NIS)
          • LDAP
        • File
          • NFS
          • Samba
        • FTP Services
          • ftpd
          • ProFTPD
          • vsftpd
          • Pure-FTPd
          • TFTP
        • Mail
          • OpenSMTPD Mail Server
          • Dovecot IMAP and POP3 Server
          • Postfix
          • Exim
          • Rspamd
        • Name
          • Unbound DNS Resolver
          • NSD Authoritative DNS Server
          • BIND DNS Server
        • Networking
          • OpenBGPD
          • rad
          • DHCP on OpenBSD
          • slaacd
        • Web
          • Apache HTTP Server
          • nginx Web Server
          • OpenBSD httpd Web Server
          • relayd Reverse Proxy
        • Logging
          • syslogd
        • Monitoring
          • SNMP
        • Remote Access
          • Audit OpenSSH
          • OpenSSH Server
        • File Synchronization
          • rsync
        • Messaging
          • RabbitMQ Message Broker
        • Time
          • NTP Time Synchronization
        • Load Balancing
          • Build Redundant Load-Balanced Gateways
          • Load Balance Services with NAT or DSR
          • Build an HA HTTPS Load Balancer
      • PF
        • pfctl cheat sheet
        • PF Anchors
        • PF Filter Rules
        • PF Forwarding
        • PF Lists and Macros
        • PF Load Balancing
        • PF Logging
        • PF NAT
        • PF Options
        • PF Policies
        • PF Shortcuts
        • PF Tables
      • Advanced Networking
        • High Availability and State Replication
        • Multi-WAN and Policy-Based Routing
        • VPN and Cryptographic Tunneling
        • Classic and Lightweight Tunnels
        • IPv6 at Scale
        • QoS and Traffic Shaping
        • MPLS and Label Distribution
        • Network Services at Scale
        • Virtualization and Host Networking
        • Large-Scale L2 and L3 Design
        • Telemetry, Logging, and Flow Export
        • Hardening and Operational Safety
        • Reference Architectures
        • Troubleshooting Playbooks
      • Serial Communication
    • Part V. Miscellaneous
      • Virtualization Cheat Sheet
      • OpenBSD Cheatsheet
      • How-to Guides
        • Installation and First Boot
          • Complete the First 30 Minutes After Installation
          • Check Hardware Compatibility Before Installing
          • Bootstrap Wi-Fi Firmware Without Ethernet
          • Run OpenBSD as a Virtual Machine Guest
          • Install OpenBSD on a VPS or Cloud Server
          • Install OpenBSD with Full-Disk Encryption
          • Dual-Boot OpenBSD on a UEFI System
          • Automate OpenBSD Installation with Autoinstall and PXE
        • Desktops and Laptops
          • Set Up OpenBSD as a Laptop or Workstation
          • Configure Laptop Power Management
          • Troubleshoot Web Browsers on OpenBSD
          • Use Plan 9 Tools on OpenBSD
          • Build a Minimal Desktop with suckless Tools
          • Install Z shell (zsh)
        • Networking and Remote Access
          • Create an Administrator Account with doas and SSH Keys
          • Configure Secure Remote Access with OpenSSH
          • Use FIDO Security Keys with OpenSSH
          • Configure Wi-Fi Roaming and Wired Failover
          • Troubleshoot PF, NAT, and Routing
          • Route Multiple VLANs with PF
          • Configure a Road-Warrior WireGuard VPN
          • Route IPv6 Networks without NAT
          • Test OpenBGPD with Two Providers
          • Unlock an Internal Service with an SSH Key
          • Build a Simple Router and Firewall
        • Servers and Services
          • Set Up WordPress on OpenBSD
          • Build a Mail Server with OpenSMTPD, Dovecot, and Rspamd
        • Security, Maintenance and Recovery
          • Establish a Conservative Security Baseline
          • Recover Access and Reset the Root Password
          • Collect OpenBSD Diagnostic Evidence
          • Troubleshoot Package Installation and Update Failures
          • Schedule Recurring Maintenance
          • Monitor an OpenBSD System
          • Back Up and Restore an OpenBSD System
          • Configure softraid RAID1
          • Recover an OpenBSD System That Does Not Boot
        • Building, Automation and Virtual Machines
          • Manage OpenBSD with Ansible
          • Build Third-Party Software from Ports
          • Build OpenBSD from Source
          • Plan a Docker Workload Migration to OpenBSD
      • OpenBSD for Linux Users
      • OpenBSD for FreeBSD Users
      • OpenBSD for macOS Users
    • OpenBSD FAQ
    • OpenBSD Architectures
      • OpenBSD Package Search
        • Synopsis
        • Default Behavior
        • Configuration File
          • Example: Client-Only Configuration
          • Example: Client and Server Configuration
        • Enabling and Starting ntpd
        • Inspecting Synchronization Status
        • Diagnose Clock Synchronization
        • Logging and Troubleshooting
        • Serving Time to Other Systems
        • Limitations and Behavior

        NTP Time Synchronization

        Synopsis #

        Accurate time matters for logs, cryptography, file timestamps, and systems that work together. OpenBSD’s base system includes ntpd(8) to set the clock from remote NTP servers. It can also provide time to other systems.

        This chapter describes how to configure ntpd(8) for typical client use and for serving time to a local network.

        Default Behavior #

        OpenBSD can enable ntpd during installation. Inspect the service setting on the installed system. The shipped /etc/ntpd.conf includes NTP servers, sensors, and HTTPS constraints; preserve those protections when adapting it. A pool-only file is not equivalent to the release defaults.

        At startup, ntpd may step the clock forward if it has sufficiently trusted time information. It does not step the clock backward, and the old -s option is no longer supported.

        Configuration File #

        The configuration file for ntpd is located at /etc/ntpd.conf. It consists of plain text directives. The most common are:

        • servers <address> — Use a pool of time servers.
        • server <address> — Use a single, specified time server.
        • listen on <interface> — Enable NTP server functionality by listening on the specified interface or address.

        Example: Client-Only Configuration #

        servers pool.ntp.org
        

        This minimal illustration uses servers selected from the NTP pool. Prefer adding server or listener settings to the shipped configuration while retaining its constraints and sensors.

        Example: Client and Server Configuration #

        servers pool.ntp.org
        listen on 192.168.1.1
        

        This example synchronizes time from external servers and serves NTP to local clients at the example LAN address 192.168.1.1.

        Enabling and Starting ntpd #

        To verify that the NTP service is enabled and running:

        doas rcctl check ntpd
        

        To manually enable and start the service:

        doas rcctl enable ntpd
        doas rcctl start ntpd
        

        Inspecting Synchronization Status #

        Use ntpctl(8) to query the status of the daemon and its peers:

        ntpctl -s status
        ntpctl -s peers
        

        These commands report information such as synchronization state, stratum level, offset, and network delay.

        Diagnose Clock Synchronization #

        ntpd remains a daemon; it is not a one-shot clock-setting client. Check source reachability, HTTPS constraints, and ntpctl -s status when the clock does not converge. Do not launch a second instance alongside the service.

        For foreground debugging:

        doas rcctl stop ntpd
        doas ntpd -d
        

        After exiting the foreground process, restart with doas rcctl start ntpd. Validate configuration changes with doas ntpd -n before restarting.

        Logging and Troubleshooting #

        ntpd logs activity to /var/log/messages. To monitor this output in real time:

        doas tail -f /var/log/messages
        

        Ensure that outbound UDP port 123 is permitted through any packet filtering rules. If time synchronization fails:

        • Verify that DNS resolution is working.
        • Use ntpctl -s peers to check reachability and response from peers.
        • Confirm that no other time services (such as rdate) are active simultaneously.

        Serving Time to Other Systems #

        To allow other systems on a local network to synchronize against the OpenBSD host, configure ntpd with a listen on directive:

        listen on 192.168.1.1
        

        Add this listener to the existing client configuration, using the actual address of the LAN interface.

        This approach is useful in environments where multiple systems must synchronize with a common internal time source or where external network access is restricted.

        Limitations and Behavior #

        OpenBSD’s ntpd focuses on simplicity and security. It intentionally omits cryptographic authentication features found in some other NTP implementations. Support for leap seconds is automatic and does not require additional configuration.

        ntpd is suitable for most client and internal server use cases, but not for highly specialized or authenticated NTP deployments.

        Report a bug
        • Synopsis
        • Default Behavior
        • Configuration File
          • Example: Client-Only Configuration
          • Example: Client and Server Configuration
        • Enabling and Starting ntpd
        • Inspecting Synchronization Status
        • Diagnose Clock Synchronization
        • Logging and Troubleshooting
        • Serving Time to Other Systems
        • Limitations and Behavior