NTP Server and client setup

Time is critical when having many server and using different clusters. So i made this guide to save all my notes when working with time.

Setting local time

I make an link to /etc/timezone

ln -sf /usr/share/zoneinfo/Etc/GMT /etc/timezone

To check if i use the correct time zone


Install ntpd



apt-get install ntp


yum install ntp


Set up my ntp server for my other server. My ntp server is and ubuntu server

server 0.ubuntu.pool.ntp.org
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.org
server 3.ubuntu.pool.ntp.org
# Use Ubuntu's ntp server as a fallback.
server ntp.ubuntu.com
#Allow ntp servers

restrict 0.ubuntu.pool.ntp.org nomodify notrap noquery
restrict 1.ubuntu.pool.ntp.org nomodify notrap noquery
restrict 2.ubuntu.pool.ntp.org nomodify notrap noquery
restrict 3.ubuntu.pool.ntp.org nomodify notrap noquery
restrict ntp.ubuntu.com nomodify notrap noquery

# Local users may interrogate the ntp server more closely.


restrict ::1

#allow clients

restrict -4 default kod notrap nomodify nopeer noquery

restrict -6 default kod notrap nomodify nopeer noquery

restrict mask notrap nomodify <--- my local network

On my ntp clients i only set server to my ntp server ip


Restart ntp servers and test it

ntpq -p