Last active
September 5, 2024 11:32
-
-
Save jeongho/d04ff0348896d93bcbff to your computer and use it in GitHub Desktop.
Local NTP server setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ntp ref: | |
------------------------------ | |
http://serverfault.com/questions/204082/using-ntp-to-sync-a-group-of-linux-servers-to-a-common-time-source/204138#204138 | |
http://www.ntp.org/ntpfaq/NTP-s-config-adv.htm | |
http://askubuntu.com/questions/14558/how-do-i-setup-a-local-ntp-server | |
http://www.thegeekstuff.com/2014/06/linux-ntp-server-client/ | |
http://www.linuxsolutions.org/faqs/generic/ntpserver | |
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s1-Understanding_the_ntpd_Configuration_File.html | |
------------------------------ | |
##### local npt server | |
ntpq -p | |
remote refid st t when poll reach delay offset jitter | |
============================================================================== | |
+100tx-f1-0.c720 216.218.192.202 2 u 23 64 377 68.491 -10.384 6.690 | |
+ec2-52-6-160-3. 209.51.161.238 2 u 26 64 377 1.204 -7.624 6.579 | |
+biisoni.miuku.n 209.118.204.201 3 u 25 64 377 68.883 -11.218 6.572 | |
*x.ns.gin.ntt.ne 18.26.4.105 2 u 25 64 377 9.036 -5.628 5.948 | |
##### Creating the NTP Master Server | |
### Step 1: Edit ntp.conf | |
# Permit all access over the loopback interface. This could | |
# be tightened as well, but to do so would effect some of | |
# the administrative functions. | |
restrict 127.0.0.1 | |
restrict -6 ::1 | |
# Hosts on local network are less restricted. | |
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap | |
#TODO: add custom network servers access to query | |
#10.11.2.56 | |
restrict 10.11.2.0 mask 255.255.255.0 nomodify notrap | |
# Use public servers from the pool.ntp.org project. | |
# Please consider joining the pool (http://www.pool.ntp.org/join.html). | |
# Use the local clock | |
# http://www.ntp.org/ntpfaq/NTP-s-refclk.htm#AEN4565 | |
#TODO: enable local ntp server as secondary source | |
server 127.127.1.0 iburst prefer | |
fudge 127.127.1.0 stratum 10 | |
server 0.centos.pool.ntp.org iburst | |
server 1.centos.pool.ntp.org iburst | |
server 2.centos.pool.ntp.org iburst | |
server 3.centos.pool.ntp.org iburst | |
#broadcast 192.168.1.255 autokey # broadcast server | |
#TODO: add custom network broadcast address | |
broadcast 10.11.2.255 | |
#broadcastclient # broadcast client | |
#broadcast 224.0.1.1 autokey # multicast server | |
#multicastclient 224.0.1.1 # multicast client | |
#manycastserver 239.255.254.254 # manycast server | |
#manycastclient 239.255.254.254 autokey # manycast client | |
### Step 2: Restart the NTP daemon | |
service ntpd stop | |
ntpdate -b 0.centos.pool.ntp.org | |
service ntpd start | |
### Step 3: Configure NTP to start on reboot | |
chkconfig ntpd on | |
ntpq -p | |
remote refid st t when poll reach delay offset jitter | |
============================================================================== | |
*LOCAL(0) .LOCL. 10 l 2 64 1 0.000 0.000 0.001 | |
10.11.255.255 .BCST. 16 u - 64 0 0.000 0.000 0.001 | |
##### Configuring the Client Machines | |
### Step 1: Edit ntp.conf | |
# Hosts on local network are less restricted. | |
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap | |
#10.11.2.56 | |
restrict 10.11.0.0 mask 255.255.0.0 nomodify notrap | |
# Use public servers from the pool.ntp.org project. | |
# Please consider joining the pool (http://www.pool.ntp.org/join.html). | |
server 10.11.2.56 iburst prefer | |
#server 0.centos.pool.ntp.org iburst | |
#server 1.centos.pool.ntp.org iburst | |
#server 2.centos.pool.ntp.org iburst | |
#server 3.centos.pool.ntp.org iburst | |
### Step 2: Restart the NTP daemon | |
service ntpd stop | |
ntpdate -b 10.11.2.56 | |
service ntpd start | |
### Step 3: Configure NTP to start on reboot | |
chkconfig ntpd on | |
ntpq -p | |
remote refid st t when poll reach delay offset jitter | |
============================================================================== | |
*10.11.2.56 .LOCL. 11 u 2 64 1 0.000 0.000 0.001 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment