Linux NTP Server Configuration
The first step, check whether the installation NTP
Run the following command:
Rpm-qa | grep NTP
If you have the following output:
ntp-4******** indicates that an NTP server is installed
If not, install it.
Step two, modify NTP the configuration file
Vi/etc/ntp.conf
①, first configuration: Allows clients of any IP to have time synchronization
Change the line "Restrict default Kod nomodify notrap nopeer noquery" to:
Restrict Defaultnomodify
②, second configuration: Only allow time synchronization for 192.168.18.*** network segment clients
Add a line after restrict default nomodify notrap noquery (which indicates that all IP is denied by the time synchronization):
restrict192.168.18.0 Mask 255.255.255.0 nomodify
ntpd after startup, the client waits a few minutes before synchronizing with the time, otherwise it prompts the "no server suitable for synchronization found" error.
3 , start ntpd with daemon process
#/etc/rc.d/init.d/ntpd-c/etc/ntp.conf-p/tmp/ntpd.pid
#/etc/rc.d/init.d/ntpd start
#ps-ef|grep ntpd
4 , when the NTP service is started on an NTP server, the NTP server itself, or the synchronization with its server, takes a period of time, which can be 5 minutes, which generates no server when the client runs the ntpdate command for synchronization Suitable forsynchronization found's error.
So how do you know when NTP server has completed the process of synchronizing itself?
To use the command on an NTP server:
# Watch Ntpq-p
The following screen appears:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6C/56/wKiom1VG0WqiMrVzAADK5M8ty4c349.jpg "title=" 1. JPG "alt=" wkiom1vg0wqimrvzaadk5m8ty4c349.jpg "/> Note that this is the NTP server that synchronizes with itself.
Note that the REACH value, after starting the NTP Server service, this value is increasing from 0, when increased to 17, from 0 to 17 is 5 times the change, each time is the value of poll seconds, is 64 seconds *5=320 seconds.
Step three, restart NTP Server
Execute command: Service ntpd Restart
Fourth Step, check whether the normal open NTP Server
Execute command: ps-ef | grep ntpd | grep-v grep
If there is an output indicating an open
then use the client to further test whether the normal synchronization to the NTP Server
use a different computer (need to install ntpdate) , perform ntpdate NTP Server Address
Eg:ntpdate 192.168.1.94
If you have a similar output like this:
17:33:39 ntpdate[29134]: Step time server 192.168.1.94 offset 3.174187 sec
Indicates a successful synchronization.
Fifth step, configure time synchronization client
Vi/var/spool/cron/root (or CRONTAB-E)
Add a row to synchronize with the time synchronization server and write to the BIOS at 1:10, 9:10, 17:10, daily
1, 9,17* * * root/usr/sbin/ntpdate 10.128.14.25; /sbin/hwclock-w
If the synchronization is not normal, you can add the output log or look at the system log
This article from the "source clean is clear, the shape of the end of the shadow straight" blog, please be sure to keep this source http://zhouxt.blog.51cto.com/8743763/1641568
Linux-based NTP server Setup