scheme
+
+
+
prettier
ansible
fedora
+
+
+
symfony
+
+
+
+
xgboost
http
+
+
+
+
ada
pnpm
solid
+
+
+
+
+
+
+
play
{}
+
rs
+
+
+
+
hugging
+
+
+
+
+
+
+
asm
+
+
django
+
++
=>
+
+
+
puppet
xml
oauth
+
+
+
+
vim
+
rubymine
+
+
+
+
alpine
+
+
+
+
+
android
+
+
+
tls
+
+
+
+
+
+
+
Back to Blog
⏰ Configuring NTP Server: Simple Guide
Alpine Linux NTP Time Server

⏰ Configuring NTP Server: Simple Guide

Published May 31, 2025

Easy tutorial for beginners to set up NTP time server on Alpine Linux. Perfect for network time synchronization with step-by-step instructions and clear examples.

6 min read
0 views
Table of Contents

⏰ Configuring NTP Server: Simple Guide

Let’s set up an NTP time server on your Alpine Linux system! 🕐 This guide uses easy steps and simple words. We’ll keep all your computers synchronized! 😊

🤔 What is an NTP Server?

An NTP server is like a master clock that keeps all your computers showing the same time!

Think of it like:

  • 📝 A town clock tower that everyone looks at
  • 🔧 A timekeeper that makes sure all clocks match
  • 💡 A service that prevents time confusion on your network

🎯 What You Need

Before we start, you need:

  • ✅ Alpine Linux system running
  • ✅ Root access or sudo permissions
  • ✅ Network connection to the internet
  • ✅ Basic knowledge of terminal commands

📋 Step 1: Install NTP Software

Install chrony Package

First, let’s install the time synchronization software! 😊

What we’re doing: Installing chrony which is a modern NTP implementation.

# Update package lists
apk update

# Install chrony (modern NTP daemon)
apk add chrony

# Install additional time utilities
apk add tzdata

What this does: 📖 Gives you tools to manage network time synchronization.

Example output:

(1/5) Installing chrony (4.3-r0)
(2/5) Installing tzdata (2023c-r1)
Executing chrony-4.3-r0.pre-install
Executing chrony-4.3-r0.post-install
OK: 25 packages installed

What this means: Your time server software is now installed! ✅

💡 Important Tips

Tip: chrony is more accurate than traditional ntpd! 💡

Warning: Wrong time can break many network services! ⚠️

🛠️ Step 2: Configure NTP Server

Set Up chrony Configuration

Now let’s configure our time server! 😊

What we’re doing: Setting up chrony to serve time to other computers.

# Backup original configuration
cp /etc/chrony/chrony.conf /etc/chrony/chrony.conf.backup

# Edit chrony configuration
nano /etc/chrony/chrony.conf

Replace the content with this configuration:

# Use public NTP servers
server 0.pool.ntp.org iburst
server 1.pool.ntp.org iburst
server 2.pool.ntp.org iburst
server 3.pool.ntp.org iburst

# Allow clients from local network
allow 192.168.1.0/24
allow 10.0.0.0/24

# Serve time even if not synchronized
local stratum 10

# Enable NTP server functionality
port 123

# Drift file to remember clock speed
driftfile /var/lib/chrony/drift

# Log directory
logdir /var/log/chrony

# Make steps larger than 1 second
makestep 1.0 3

# Enable kernel synchronization
rtcsync

Code explanation:

  • server: External time sources to sync with
  • allow: Networks that can get time from this server
  • local stratum 10: Act as time source even when offline
  • port 123: Standard NTP port
  • makestep: Allow big time corrections

What this means: Your server can now provide time to other computers! 🎉

🎮 Step 3: Start NTP Service

Enable and Start chrony

Let’s start the time service! 🎯

What we’re doing: Starting the NTP server so other computers can sync time.

# Add chrony to startup services
rc-update add chronyd default

# Start chrony service now
rc-service chronyd start

# Check if it's running
rc-service chronyd status

You should see:

* service chronyd added to runlevel default
* Starting chronyd ...
* start-stop-daemon: started /usr/sbin/chronyd
 * chronyd: started

Great job! Your time server is running! 🌟

📊 Step 4: Test Time Synchronization

Check Server Status

Now let’s verify our NTP server is working! 😊

What we’re doing: Testing that our time server is properly synchronized and serving time.

# Check chronyd status
chronyc tracking

# List time sources
chronyc sources

# Show detailed source information
chronyc sourcestats

# Check if serving clients
chronyc clients

Expected output:

Reference ID    : A9FC9440 (ntp1.example.com)
Stratum         : 3
Ref time (UTC)  : Thu May 31 17:15:30 2025
System time     : 0.000000123 seconds fast of NTP time
Last offset     : -0.000000456 seconds
RMS offset      : 0.000001234 seconds

Awesome work! Your time server is synchronized! 🌟

🎮 Let’s Try It!

Time for hands-on practice! This is the fun part! 🎯

What we’re doing: Testing our NTP server by checking time from another computer.

# On another computer, test our NTP server
ntpdate -q YOUR_SERVER_IP

# Example: ntpdate -q 192.168.1.100

# Or use chrony to check
chronyc -h YOUR_SERVER_IP tracking

# Check if port 123 is open
netstat -ulnp | grep :123

You should see:

server 192.168.1.100, stratum 3, offset 0.000123, delay 0.001234
udp        0      0 0.0.0.0:123           0.0.0.0:*                           1234/chronyd

Awesome work! Your NTP server is serving time! 🌟

📊 Quick Summary Table

What to DoCommandResult
🔧 Install chronyapk add chrony✅ NTP software installed
🛠️ Configure serverEdit /etc/chrony/chrony.conf✅ Server ready to serve time
🎯 Start servicerc-service chronyd start✅ Time server running
🚀 Test syncchronyc tracking✅ Time synchronized

🌐 Step 5: Configure Clients

Set Up Time Clients

Let’s configure other computers to use our time server! 🌐

What we’re doing: Setting up client computers to get time from our server.

# On client computers, edit chrony configuration
nano /etc/chrony/chrony.conf

Add your server as primary time source:

# Use local NTP server first
server 192.168.1.100 iburst prefer

# Backup public servers
server 0.pool.ntp.org iburst
server 1.pool.ntp.org iburst

# Basic client configuration
driftfile /var/lib/chrony/drift
makestep 1.0 3
rtcsync

What this does: Makes client computers get time from your server first! 📚

Example: Configure Firewall Rules 🟡

What we’re doing: Opening firewall ports for NTP traffic.

# Allow NTP traffic (port 123)
iptables -A INPUT -p udp --dport 123 -j ACCEPT

# Allow from specific network only
iptables -A INPUT -p udp -s 192.168.1.0/24 --dport 123 -j ACCEPT

# Save firewall rules
rc-service iptables save

What this does: Ensures NTP traffic can reach your server! 🌟

🚨 Fix Common Problems

Problem 1: Time not syncing ❌

What happened: Server can’t synchronize with external time sources. How to fix it: Check network and DNS!

# Test internet connectivity
ping 0.pool.ntp.org

# Check DNS resolution
nslookup pool.ntp.org

# Force time sync
chronyc makestep

Problem 2: Clients can’t connect ❌

What happened: Client computers can’t get time from server. How to fix it: Check firewall and network!

# Test NTP port connectivity
nc -u SERVER_IP 123

# Check if chronyd is listening
netstat -ulnp | grep :123

# Verify allow rules in config
grep "allow" /etc/chrony/chrony.conf

Problem 3: Time drifts badly ❌

What happened: Clock loses accuracy over time. How to fix it: Check system and hardware!

# Check system load
top

# Monitor time drift
chronyc tracking

# Check for hardware issues
dmesg | grep -i clock

Don’t worry! These problems happen to everyone. You’re doing great! 💪

💡 Simple Tips

  1. Use multiple time sources 📅 - Don’t rely on just one server
  2. Monitor time accuracy 🌱 - Check drift regularly
  3. Secure your server 🤝 - Only allow trusted networks
  4. Keep logs 💪 - Monitor chronyd log files

✅ Check Everything Works

Let’s make sure everything is working:

# Check chrony service status
rc-service chronyd status

# Verify time synchronization
chronyc tracking

# Check client connections
chronyc clients

# Test NTP port
netstat -ulnp | grep :123

# Show current time
date

# You should see this
echo "NTP server is working! ✅"

Good output:

 * chronyd: started
Reference ID    : A9FC9440 (ntp1.example.com)
Stratum         : 3
System time     : 0.000000123 seconds fast of NTP time
Hostname                      NTP   Drop Int IntL Last     Cmd   Drop Int  Last
===============================================================================
192.168.1.101                  25      0   6   -    17       0      0   -     -
udp        0      0 0.0.0.0:123           0.0.0.0:*                           1234/chronyd
Thu May 31 17:30:00 UTC 2025
✅ Success! NTP server is working perfectly.

🏆 What You Learned

Great job! Now you can:

  • ✅ Set up an NTP time server on Alpine Linux
  • ✅ Configure network time synchronization
  • ✅ Allow clients to sync time from your server
  • ✅ Monitor and troubleshoot time issues
  • ✅ Secure your time server properly

🎯 What’s Next?

Now you can try:

  • 📚 Setting up redundant time servers
  • 🛠️ Monitoring time accuracy with scripts
  • 🤝 Implementing time-based authentication
  • 🌟 Creating time synchronization alerts!

Remember: Every expert was once a beginner. You’re doing amazing! 🎉

Keep practicing and you’ll become a time server expert too! 💫