Linux Learning Essay 5--building NTP server

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.