Linux environment NTP configuration and boot-up

Source: Internet
Author: User

Configuring NTP servers under Linux
First, preface:
Default NTP service port:
Udp/123
The NTP working mode configured in this article:
Using the Client/server method, this method is applicable to a time server receiving the time information of the upper time server and providing time information to the downlevel users.
Second, the configuration method:
1. NTP Service installation
NTP service in rhel5.x Chinese default installed package, available Rpm-qa |grep NTP check whether installed, if not installed can use the following command to install and remove NTP server package

#使用rpm方式安装
RPM-IVH NTP-4.2.2P1-8.EL5.I386.RMP
#使用yum方式安装
Yum-y Install ntp.i*
#使用rpm方式删除
Rpm-e ntp-4.2.2pl-8.el5.i386.rpm
#使用yum方式删除
Yum-y Remove ntp.i*

2. NTP service configuration
After the NTP service installation is complete, you need to modify the NTP service configuration file. NTP Service master configuration file/etc/ntp.conf

2.1 Start, pause of NTP service
NTP belongs to the System V service, and its start and pause related commands are as follows:
#启动
Service NTPD Start
#停止
Service ntpd Stop
#重新加载
Service NTPD Reload
#查看当前启动状态
Service NTPD Status
2.2 NTP service auto-load
Set NTP service next boot run state can be configured by command
Set to run automatically on #在运行级别2, 3, 4, 5
Chkconfig ntpd on
Set to not run automatically on #在运行级别2, 3, 4, 5
Chkconfig ntpd off
Set to run automatically on #在运行级别3, 5
Chkconfig ntpd--level
Set to not run automatically on #在运行级别3, 5
Chkconfig ntpd--level off

2.3 Configuration information
Configure NTP to use a time server on the Internet as the internal standard time source, as follows
1) Modify the/etc/ntp.conf file
Restrict default Kod nomodify notrap nopeer noquery

Restrict 127.0.0.1
Restrict-6:: 1

Restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap
Restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

#指定Internet上的时间服务器
Restrict 207.46.232.182 mask 255.255.255.255 nomodify notrap noquery
Server 207.46.232.182

Server 127.127.1.0
Fudge 127.127.1.0 Stratum 10
Keys/etc/ntp/keys

#指定NTP服务器日志文件
Logfile/var/log/ntp

2) Modify the/etc/ntp/stpe-tickers file as follows (when the NTPD service starts, it is automatically proofread with the upper NTP service recorded in the file)
207.46.232.182
127.127.1.0
3) Modify the/etc/sysconfig/ntpd file with the following contents:
#允许BIOS与系统时间同步, you can also use the HWCLOCK-W command
Sync_hwclock=yes
4) After the configuration has completed and restarted the service, you can use the Ntpstat command to display the local synchronization time with the upper NTP server, or to view the native and upper NTP server communication situation using NTPQ-P

2.4 Graphical Interface Configuration NTP
Using system-config-date directly under the graphical interface, select "Synchronize system clock before starting service" after specifying the NTP server on the "Network Time Protocol" option page. Set the NTPD service to run automatically.


2.5 Client Access
1) The Linux client can be configured through the GUI, or it can be checked with the NTP server and your line time with the Ntpdate command immediately.
ntpdate 192.168.0.10
2) Windows client, simply double-click the clock in the lower right corner of the taskbar, select the Internet Time option page, enter the NTP service IP address or FQDN, and tick "Automatically synchronize with Internet time Server".
Windows is automatically updated by default 7 days, by modifying the registry hkey_local_machine\system\currentcontrolset\services\w32time\timeproviders\ Ntpclient\specialpollinterval default unit is good, modified after the restart can take effect

Linux environment NTP configuration and boot self-boot (RPM)

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.