Linux ntp time server and client installation Configuration

Source: Internet
Author: User

Linux ntp time server and client installation and configuration 1. Main file and command:/etc/ntp. conf server configuration file/etc/sysconfig/clock time zone configuration file/bin/date display and set the time command/sbin/hwclock for BIOS clock (hardware clock) the command/usr/sbin/ntpd is mainly used to provide the NTP service program/usr/sbin/ntpdate for the client time correction www.2cto.com 2. SERVER: Check whether the software is installed: [root @ localhost ~] # Rpm-qa | grep ntp ntp-4.2.2p1-9.el5_4.1 (this is already installed RPM package, or another version of ntp) if not installed, can be downloaded from http://support.ntp.org/bin/view/main/softwaredownloads, install rpmpackage: [root @ localhost ~] # Rpm-ivh ntp-4.2.2p1-9.el5_4.1.rpm 3. Back up the configuration file cp/etc/ntp. conf/etc/ntp. conf_bak 4, ntp. description of main parameters in the conf file: 4.1. Use restrict to manage permissions and control restrict [Your IP] mask [netmask_IP] [parameter]. The parameters of parameter mainly include the following: ignore: deny all types of NTP connections; nomodify: the client cannot use the ntpc and ntpq programs to modify the server's time parameters, but the client can still use this host for network calibration; noquery: the client cannot use commands such as ntpq and ntpc to query the time server, which is equal to network time when NTP is not provided. notrap: remote event logging is not provided) of Function. Notrust: rejects unauthenticated clients. 4.2 Use server to set the upper-layer NTP server [IP or hostname] [prefer] perfer to indicate 'use preferentially '5. The specific configuration is as follows: comment out the original upper-layer server and upper-layer restrictions, then add these servers into the prefer server time.nist.gov restrict limit mask limit 255 nomodify notrap noquery restrict limit mask limit 255 nomodify notrap noquery restrict 192.168.1.0 mask limit 255.0 nomodify # For Intranet access, modify www.2cto.com 6 for different network segment settings and restart the service:/etc/init. d /Ntpd restart 7. Add boot start: chkconfig ntpd on 8. Check the system log to see if there is any error: tail/var/log/messages 9. Check the start Port: netstat-tlunp | grep ntp 10. Check whether the synchronization with the upper-layer server is successful (it will be connected to the upper-layer server after about 15 minutes ): ntpstat or ntpq-p 11: manually check the server. If the error does not exceed 1000 seconds, the service will automatically stop: date MMDDHHMMCCYY. SS # Set the time. Format: Month, month, day, hour, minute, and year. seconds/etc/init. d/ntpd stop # stop the service because ntp and ntpdate cannot take effect at the same time ntpdate 210.72.145.44 hwclock-w # The hardware write time.-r indicates the hardware time/etc/init. d/ntpd restart www.2cto.com 12. Other clients must be synchronized. In this way: vim/etc/crontab */10 ***** root (/usr/sbin/ntpdate 210.72.145.44 &/sbin/hwclock-w) &>/dev/null/etc/init. d/crond restart 13. Key points: There are two types of Linux systems: one is the system time counted starting from 1970/01/01, and the other is the hardware time recorded by the BIOS; in Linux, NTP servers can be used in the most common network schools during network school hours. This service is started on udp port 123, and the time zone files are mainly stored in the/usr/share/zoneinfo/directory, for the local time zone, see/etc/localtime. The NTP server is a class-based service, so the NTP server will be synchronized with the upper-layer time server, therefore, the nptd and ntpdate commands are not It can be used at the same time. You can use ntpstat and ntpq-p to query the online status of the NTP server. The client software provided by NTP is the ntpdate command. If you want to manually process the time in Linux, you need to set the time with date and write the time recorded by BIOS with hwclock-w. The time error between NTP servers cannot exceed 1000 seconds. Otherwise, the NTP service is automatically disabled.

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.