MikroTik RouterOS NTP Server: Distributing Time to LAN Clients
MikroTik RouterOS NTP Server: Distributing Time to LAN Clients
Section titled âMikroTik RouterOS NTP Server: Distributing Time to LAN ClientsâRouterOS Version: 7.x (v6 required separate NTP package) Difficulty: Beginner Estimated Time: 15 minutes
Overview
Section titled âOverviewâRouterOS includes a built-in NTP (Network Time Protocol) server that allows your router to distribute accurate time to LAN clients. The NTP server operates on UDP port 123 and supports unicast, broadcast, multicast, and manycast modes.
Critical prerequisite: The NTP server only becomes active when the local NTP client is synchronized. If the routerâs own time isnât accurate, it wonât serve time to clients.
Common use cases include:
- Centralized time source - All LAN devices sync to the router
- Isolated networks - Provide time when no internet access available
- Reduce external queries - Clients sync locally instead of querying internet NTP servers
- Consistent logging - Ensure all devices have synchronized timestamps
Key Concepts
Section titled âKey ConceptsâServer Activation Requirement
Section titled âServer Activation RequirementâThe NTP server only activates when the NTP client status is either:
- synchronized - Synced to an external NTP server
- using-local-clock - Using the routerâs internal clock (not recommended)
If the client shows any other status, the server ignores all NTP requests.
Server Modes
Section titled âServer Modesâ| Mode | Description | Use Case |
|---|---|---|
| Unicast | Clients request time by sending packets to routerâs IP | Default; most common for LAN |
| Broadcast | Router sends time to broadcast addresses periodically | Legacy devices |
| Multicast | Router sends time to multicast group 224.0.1.1 | Specialized deployments |
| Manycast | Discovery-based mode for finding NTP servers | Auto-discovery scenarios |
Stratum
Section titled âStratumâStratum indicates how many âhopsâ from a reference clock. The routerâs stratum is always its upstream source stratum + 1. You cannot fake a lower stratum value.
Configuration Steps
Section titled âConfiguration StepsâStep 1: Configure and Verify NTP Client (Prerequisite)
Section titled âStep 1: Configure and Verify NTP Client (Prerequisite)âThe NTP server wonât work until the router itself has accurate time:
/system/ntp/client/set enabled=yes/system/ntp/client/servers/add address=pool.ntp.orgVerify synchronization:
/system/ntp/client/printExpected: status: synchronized
Wait for synchronization before proceeding. This may take a few minutes.
Step 2: Enable NTP Server
Section titled âStep 2: Enable NTP Serverâ/system/ntp/server/set enabled=yesStep 3: Verify Server Configuration
Section titled âStep 3: Verify Server Configurationâ/system/ntp/server/printExpected Output:
enabled: yes broadcast: no multicast: no manycast: no broadcast-addresses: vrf: main use-local-clock: no local-clock-stratum: 5 auth-key:Step 4: Distribute NTP Server via DHCP
Section titled âStep 4: Distribute NTP Server via DHCPâConfigure DHCP to tell clients where to find the NTP server:
/ip/dhcp-server/network/set [find] ntp-server=192.168.1.1Replace 192.168.1.1 with your routerâs LAN IP address.
Common Configuration Scenarios
Section titled âCommon Configuration ScenariosâScenario 1: Basic LAN Time Server
Section titled âScenario 1: Basic LAN Time ServerâStandard setup for home or small office:
# Ensure NTP client is working/system/ntp/client/set enabled=yes/system/ntp/client/servers/add address=pool.ntp.org
# Enable NTP server/system/ntp/server/set enabled=yes
# Distribute via DHCP/ip/dhcp-server/network/set [find] ntp-server=192.168.88.1Scenario 2: NTP Server with Broadcast Mode
Section titled âScenario 2: NTP Server with Broadcast ModeâFor legacy devices that donât query NTP but listen for broadcasts:
/system/ntp/server/set enabled=yes broadcast=yes broadcast-addresses=192.168.1.255Note: Use the subnet broadcast address (e.g., X.X.X.255 for /24 networks), not a host IP.
Scenario 3: Isolated Network (No Internet)
Section titled âScenario 3: Isolated Network (No Internet)âWhen no external NTP source is available, use the local clock as fallback:
/system/ntp/server/set enabled=yes use-local-clock=yes local-clock-stratum=10Warning: The routerâs internal CPU clock is unreliable. Time will drift significantly (minutes per day). Most MikroTik devices lack battery-backed RTC, so time resets to 1970 on power loss.
Set time manually if needed:
/system/clock/set date=jan/16/2026 time=14:30:00 time-zone-name=America/New_YorkScenario 4: DHCP Option 42 (Alternative Method)
Section titled âScenario 4: DHCP Option 42 (Alternative Method)âSome clients prefer DHCP option 42 over the ntp-server field:
# Create DHCP option/ip/dhcp-server/option/add name=ntp-server code=42 value="'192.168.1.1'"
# Assign to DHCP network/ip/dhcp-server/network/set [find] dhcp-option=ntp-serverImportant: Option 42 only accepts IP addresses, not domain names.
Scenario 5: NTP Server with Authentication
Section titled âScenario 5: NTP Server with AuthenticationâFor environments requiring authenticated NTP:
# Create symmetric key/system/ntp/client/keys/add id=1 key=mysecretkey
# Apply key to server/system/ntp/server/set auth-key=1Clients must be configured with the same key to authenticate.
Scenario 6: NTP Server in Specific VRF
Section titled âScenario 6: NTP Server in Specific VRFâBind NTP server to a VRF:
/system/ntp/server/set enabled=yes vrf=customer1Firewall Configuration
Section titled âFirewall ConfigurationâIf using a restrictive firewall, allow NTP from LAN:
/ip/firewall/filter/add chain=input protocol=udp dst-port=123 src-address=192.168.1.0/24 action=accept comment="Allow NTP from LAN" place-before=0Key point: NTP traffic to the router uses the input chain, not forward.
Verification
Section titled âVerificationâCheck 1: Verify NTP Client Synchronized
Section titled âCheck 1: Verify NTP Client Synchronizedâ/system/ntp/client/printExpected: status: synchronized
Check 2: Verify NTP Server Enabled
Section titled âCheck 2: Verify NTP Server Enabledâ/system/ntp/server/printExpected: enabled: yes
Check 3: Check for Firewall Blocking
Section titled âCheck 3: Check for Firewall Blockingâ/ip/firewall/filter/print where dst-port=123Expected: No blocking rules, or explicit allow rule for UDP 123.
Check 4: Test from Client
Section titled âCheck 4: Test from ClientâOn a Linux client:
ntpdate -q 192.168.1.1On Windows:
w32tm /stripchart /computer:192.168.1.1 /samples:3Check 5: Check NTP Logs
Section titled âCheck 5: Check NTP Logsâ/log/print where topics~"ntp"Troubleshooting
Section titled âTroubleshootingâProblem: âClients canât sync - connection refused or timeoutâ
Section titled âProblem: âClients canât sync - connection refused or timeoutââCause: NTP client not synchronized; server only activates when client is synced.
Solution:
- Check NTP client status:
/system/ntp/client/print
- If not synchronized, verify upstream NTP server is reachable:
/ping pool.ntp.org count=3
- Wait for synchronization (may take several minutes)
Problem: âFirewall blocking NTP requestsâ
Section titled âProblem: âFirewall blocking NTP requestsââCause: UDP port 123 blocked on input chain.
Solution:
/ip/firewall/filter/add chain=input protocol=udp dst-port=123 action=accept place-before=0Problem: âBroadcast mode not reaching clientsâ
Section titled âProblem: âBroadcast mode not reaching clientsââCause: Invalid broadcast address (using host IP instead of broadcast).
Solution: Use proper subnet broadcast address:
# Wrong/system/ntp/server/set broadcast-addresses=192.168.1.1
# Right/system/ntp/server/set broadcast-addresses=192.168.1.255Problem: âWindows clients reject NTP serverâ
Section titled âProblem: âWindows clients reject NTP serverââCause: Stratum too high (Windows requires stratum < 15).
Solution: Ensure upstream NTP source has reasonable stratum. Avoid using local clock with high stratum values.
Problem: âTime resets to 1970 after rebootâ
Section titled âProblem: âTime resets to 1970 after rebootââCause: Most MikroTik devices lack battery-backed RTC.
Solution:
- Use NTP client for external sync (automatic after boot)
- For isolated networks, consider a script to disable NTP server until synced:
/system/scheduler/add name=wait-for-ntp on-event="/delay 5m; /system/ntp/server/set enabled=yes" start-time=startup
Problem: âISP blocking UDP port 123â
Section titled âProblem: âISP blocking UDP port 123ââCause: Some ISPs block NTP for DDoS mitigation.
Solution: Use NAT to translate source port:
/ip/firewall/nat/add chain=srcnat protocol=udp src-port=123 action=src-nat to-ports=1024-65535 out-interface=ether1-wanProblem: âClients get âKiss of Deathâ (KoD) responseâ
Section titled âProblem: âClients get âKiss of Deathâ (KoD) responseââCause: Routerâs NTP client still synchronizing.
Solution: Wait for NTP client to fully synchronize. Check status:
/system/ntp/client/printCommon Pitfalls
Section titled âCommon Pitfallsâ1. Enabling Server Before Client Syncs
Section titled â1. Enabling Server Before Client SyncsâWrong:
/system/ntp/server/set enabled=yes# Client not configured - server won't respondRight:
/system/ntp/client/set enabled=yes/system/ntp/client/servers/add address=pool.ntp.org# Wait for sync.../system/ntp/server/set enabled=yes2. Using Domain Name in DHCP Option 42
Section titled â2. Using Domain Name in DHCP Option 42âWrong:
/ip/dhcp-server/option/add name=ntp code=42 value="'pool.ntp.org'"# Option 42 only accepts IP addressesRight:
/ip/dhcp-server/option/add name=ntp code=42 value="'192.168.1.1'"3. Firewall Rule in Wrong Chain
Section titled â3. Firewall Rule in Wrong ChainâWrong:
/ip/firewall/filter/add chain=forward protocol=udp dst-port=123 action=accept# NTP to router uses input chain, not forwardRight:
/ip/firewall/filter/add chain=input protocol=udp dst-port=123 action=accept4. Relying on Local Clock for Production
Section titled â4. Relying on Local Clock for ProductionâWrong:
/system/ntp/server/set enabled=yes use-local-clock=yes# CPU clock drifts; no RTC batteryRight: Always use external NTP sync when possible. Local clock is emergency fallback only.
5. Expecting Low Stratum from GPS
Section titled â5. Expecting Low Stratum from GPSâReality: MikroTik doesnât support PPS (Pulse Per Second). GPS gives stratum 4 at best, not stratum 1. For stratum 1, use a dedicated NTP server with PPS support.
Key Properties Reference
Section titled âKey Properties Referenceâ| Property | Type | Default | Description |
|---|---|---|---|
enabled | yes/no | no | Enable NTP server |
broadcast | yes/no | no | Enable broadcast mode |
multicast | yes/no | no | Enable multicast mode |
manycast | yes/no | no | Enable manycast mode |
broadcast-addresses | IP list | - | Addresses for broadcast mode |
vrf | VRF name | main | VRF for NTP traffic |
use-local-clock | yes/no | no | Serve time from local clock |
local-clock-stratum | integer | 5 | Stratum when using local clock |
auth-key | key ID | none | NTP symmetric key for auth |
Limitations
Section titled âLimitationsâ- NTP server only one auth-key supported
- Cannot achieve stratum lower than upstream + 1
- Local clock unreliable (drift with temperature, no RTC battery)
- Broadcast mode requires explicit broadcast addresses
- DHCP option 42 requires IP address, not hostname
Version Differences
Section titled âVersion Differencesâ| Version | Notes |
|---|---|
| v7 | NTP integrated into core system; VRF support; NTP authentication |
| v6 | Required separate NTP package; different menu path (/system ntp-server) |
Related Features
Section titled âRelated Featuresâ- NTP Client (
/system/ntp/client) - Must be synchronized for server to work - Clock (
/system/clock) - System time and timezone - DHCP Server (
/ip/dhcp-server) - Distribute NTP server to clients - Firewall (
/ip/firewall) - May need rules for UDP 123
References
Section titled âReferencesâRelated Topics
Section titled âRelated TopicsâPrerequisites
Section titled âPrerequisitesâ- NTP Client - must be synchronized before server works
Network Services
Section titled âNetwork Servicesâ- DHCP Server - distribute NTP server address to clients
- DNS Server - related network service
Security
Section titled âSecurityâ- Firewall Basics - allow UDP port 123 for NTP
Related System
Section titled âRelated Systemâ- Scheduler - time-based automation
- Logging - accurate timestamps for log entries
- Certificates - require accurate time for validation