NTP Client Preferring LOCAL(0) Over Remote Server: Stratum Hierarchy Analysis and Fixes


4 views

When your NTP client shows *LOCAL(0) as the sync source instead of your designated server (10.130.33.201), this indicates a stratum hierarchy conflict. The asterisk marks the currently selected time source, and the refid LOCAL(0) suggests your upstream server isn't providing authoritative time.

# Problematic output example:
ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 10.130.33.201   LOCAL(0)         9 u   49   64  377    0.242  -3742.2   1.049
*LOCAL(0)        .LOCL.          10 l    2   64  377    0.000    0.000   0.001

NTP clients automatically prefer lower-stratum sources. When your server (stratum 9) reports its source as LOCAL(0), clients see this as equivalent to their own local clock (stratum 10) and choose the "closer" option. This isn't a bug - it's by design in the NTP algorithm.

Option 1: Make your server authoritative

On your time server (10.130.33.201), ensure it has either:

  • Internet NTP sources (preferred)
  • Hardware clock reference
# Example working server config:
server 0.pool.ntp.org iburst
server 1.pool.ntp.org iburst
server 127.127.1.0    # local clock as backup
fudge 127.127.1.0 stratum 12  # Higher than internet sources

Option 2: Force client behavior (without config changes)

Try these temporary client-side commands:

# Demote local clock preference
ntpd -g -x -c /etc/ntp.conf

# Force sync with specific server
ntpdate -u 10.130.33.201

The prefer flag only affects selection between equal-stratum sources. Since LOCAL(0) appears more authoritative (stratum 9 vs your server's stratum 10), the flag has no effect.

If your server must use local time while clients sync to it:

# Server config (10.130.33.201):
server 127.127.1.0
fudge 127.127.1.0 stratum 8  # Must be lower than clients' local stratum

# Client config:
server 10.130.33.201 iburst
# Remove all local clock references

This creates an artificial hierarchy where your server appears more authoritative than the clients' local clocks.

After changes, verify with:

ntpq -pn
watch -n 1 ntpstat
ntptrace -n 10.130.33.201

When examining NTP synchronization issues, the ntpq -p output reveals critical information about time sources. In your case, the asterisk next to LOCAL(0) indicates the system is preferring its local clock over the configured remote server (10.130.33.201). This occurs because:

ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 10.130.33.201   LOCAL(0)         9 u   49   64  377    0.242  -3742.2   1.049
*LOCAL(0)        .LOCL.          10 l    2   64  377    0.000    0.000   0.001

The fundamental issue stems from the stratum levels in your NTP configuration. Your server (10.130.33.201) is advertising itself as stratum 9 (shown in the refid column as LOCAL(0)), while your local clock is stratum 10. NTP's algorithm will prefer the lower-jitter source with better stability, which in this case is the local clock.

Your ntp.conf contains two critical elements causing this behavior:

server 10.130.33.201 burst iburst minpoll 4 maxpoll 11
server 127.127.1.0     # local clock
fudge 127.127.1.0 stratum 10

The key problems are:

  1. The remote server is itself syncing to LOCAL(0) (stratum 9)
  2. Your local clock is configured at stratum 10
  3. NTP sees both sources as equally valid but prefers the lower-jitter local clock

For your specific requirement (all devices syncing to 10.130.33.201 regardless of accuracy), implement these changes:

# On the server (10.130.33.201):
server 127.127.1.0
fudge 127.127.1.0 stratum 8

# On client machines:
server 10.130.33.201 prefer
restrict 127.127.1.0 ignore  # Disable local clock

Your attempt with the prefer keyword failed because:

  • The server's time source (LOCAL(0)) had equal validity to the client's LOCAL(0)
  • NTP's selection algorithm prioritizes stability over preference when stratum levels are similar
  • The 3-second offset made the remote server appear less reliable

Regarding your concern about server unreachability:

# This configuration will:
# 1. Try the primary server first
# 2. If unavailable, use pool.ntp.org as backup
# 3. Only use local clock if both fail

server 10.130.33.201 iburst prefer
server 0.pool.ntp.org iburst
server 127.127.1.0
fudge 127.127.1.0 stratum 12  # Make local clock least preferred

For environments where all devices must sync to a local server regardless of internet access:

# On the primary time server:
server 127.127.1.0
fudge 127.127.1.0 stratum 8
disable ntp

# On all client machines:
server 10.130.33.201 prefer
restrict 127.127.1.0 ignore

This ensures:

  • Clients will always prefer the designated server
  • The local clock is completely disabled on clients
  • The primary server maintains consistent time across the network

Use these commands to verify proper operation:

# Check synchronization status:
ntpq -pn

# Verify the current time source:
ntpstat

# Check detailed synchronization info:
ntptime

# Monitor NTP daemon operations:
tail -f /var/log/ntp.log