Linux LAN Sync Time

Source: Internet
Author: User

  1. Select a machine that can sisu the network as a time server (can not be on or on the optional one, but only to ensure that the LAN time synchronization)
  2. Configure this time server
    • install NTP
    • Configure
      • [plain]  view plain  copy  
        1. restrict 127.0.0.1 //give native all permission   
        2. restrict -6 ::1 //not quite clear, for IPV6?   
        3. restrict 192.168.1.0 mask 255.255.255.0 nomodify  notrap //to the local area network host synchronization time permission, but does not allow the modification time server time   
        4. server 0.rhel.pool.ntp.org //time Server, The same   
        5. SERVER 1.RHEL.POOL.NTP.ORG  
        6. Server 2.rhel.po ol.ntp.org  
      • rest with default configuration
  3. Configuring the machine inside the LAN
    • Installing NTP
    • Configuring in/ect/ntp.conf
      • Comment out the original extranet time server and add the Intranet time server:
      • 1. Server 192.168.1.100//modify IP for your intranet time server
    • Set up scheduled tasks that are synchronized once per hour:
        1. vi/etc/cron.hourly/ntpdatehourly.sh
        2. Add the following content:
        3. #!/bin/sh
        4. Ntpdate 192.168.1.100
    • Stop NTPD Services: Service NTPD stop
    • Manual synchronization time, performed on each node: ntpdate 192.168.1.100

    • To set up an interval at any time on the basis of synchronization method:
      • Vi/etc/crontab, as follows:
      • From the general requirements that you can see the timing task instructions written
      • We can add a new timed task with CRONTAB-E and enter it in the new file edit box that pops up:
          1. */15 * * * * ntpdate 192.168.1.100
      • Then save exit, you will be prompted to add a new task (the above task represents "no interval 15 minutes to the time server 192.168.1.100 synchronization Time")
      • You can use the command crontab-u root-l to view the root user's scheduled tasks
    • Linux scheduled tasks are pretty useful things, detailed explanation see my other blog: Click here

      • Obviously, regardless of the way you synchronize time periodically, the NTPD service on the remaining nodes of the time server must be stopped.
      • If you feel that your configuration is all fine, but the time is still not synchronized, then please pay attention to your firewall settings, namely: Service iptables

Linux LAN Sync Time

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.