2015.8.30
NTP server
NTP server (Network time Protocol), is used to do LAN server synchronization, to ensure that the local area network server and time server consistency, some applications to the real-time requirements of the application must be unified time
There are also many time servers on the Internet, pool.ntp.org (official NTP time server)
The NTP server needs to turn on 123 port (UDP) to view the open ports on the Linux system: Netstat-an
Open Port 123 on the local firewall:
Add a rule in Vi/etc/sysconfig/iptables:-a input-m State--state new-m udp-p UDP--dport 123-j ACCEPT
To install the NTP service:
Yum install NTP ntpdate-y #-Y to execute without confirmation
Modifying the ntp.conf configuration file
To back up the configuration file before you modify it: Cp/etc/ntp.conf/etc/ntp.conf.bak
Then modify: vi/etc/ntp.conf
Start the NTP service:/etc/init.d/ntpd restart
View NTP connection information: ntpq-p
View system time: Date
Time synchronization between client and NTP server: ntpdate (NTP server IP)
Stop NTP service:/ETC/INIT.D/NTPD stop
Crontab Scheduled Tasks
Crontab-e into task add
#每天的6点30分与时间服务器 (192.168.1.3) for time synchronization and log generation
* * * * /usr/sbin/ntpdate 192.168.1.3 >>/usr /local/ntpdate.log
LAN NTP server configuration file:
Driftfile/var/lib/ntp/drift
Restrict default Kod nomodify notrap nopeer noquery
restrict-6 default Kod nomodify notrap nopeer noquery
Restrict 127.0.0.1 #开启内部网络递归接口IO
Restrict-6::1
Server 127.127.1.0 #local Clock
Fudge 127.127.1.0 Stratum 10
Keys/etc/ntp/keys
The NTP server is built.
Linux Learning Essay 5--building NTP server