Time for Linux to synchronize Windows

Source: Internet
Author: User
Tags net time sntp server

Find a lot of information, do not have windows to do time services, Linux synchronization Windows time, and finally found some software, finally took care of, write to share, so as to avoid many detours

First in http://www.meinberg.de/english/sw/index.htm

Downloaded an NTP service program for Windows: Ntp4171.zip

Windows 192.168.1.32

1. Installation is prompt to set the server address, I set the IP of the native widows machine

Control of the 2.NTPD in:

Control Panel->; Management Tools->; Component Services-networktimeprotocol

3. Can start the ntpd daemon to keep time synchronized

4. There is an NTP configuration file under the C:\WINNT directory ntp.conf

Set to:

Server 127.127.1.0 prefer

Fudge 127.127.1.0 Stratum 10

5. Determine if NTP is working: ntpq-p

Linux and Windows Sync, I'm using RedHat9.0.

Execute command: Ntpdate 192.168.1.32

You'll find that your time is changing, just like the 192.168.1.32 time.

If there is an error executing the command

1. Hint: 7Dec 19:24:55 ntpdate[2120]: The NTP socket is on use, exiting

This is the process that already exists on your Linux machine, input: Ps-ef | Grepntpd

Kill the NTP process

2. Hint: Noserver suitable for synchronization found

This is the most likely problem, it is more common to configure the server and start the server process, immediately

Start the client process and the client process will get an error. The workaround is to start the process in about 3-5 minutes.

I want to sync time with Windows service every 10 minutes

1. Create your own crontab file, build a file Date.cron, you can use any text first

The editor creates a new file and writes to it the command to run and the time to execute it periodically.

VI date.cron Add the following command to run and the time to execute periodically

*/10 * * * */usr/sbin/ntpdate192.168.1.32

Then save the disk.

2. Use the crontab command to install the file so that it becomes the user's crontab file. Type:

Crontabdate.cron

This file is already set up.

3. Use the command:

Crontab-l (View scheduled job sequences) you can see just the job

Such as:

[Email protected] root]# crontab-l

# do not EDIT this file-edit themaster and reinstall.

# (Date.cron installed on Tue Dec 718:22:42 2004)

# (Cron version--$Id: crontab.c,v2.13 1994/01/17 03:20:37 vixieexp $)

*/10 * * * */usr/sbin/ntpdate192.168.1.32

Now it's OK, every 10 minutes Linux is synchronized with the server.

====================================================================

1, Linux host to do time server (take RedHat9.0 as an example)
First step: Check if you have an NTP package installed. Enter "Rpm-qa|grep NTP" if the installation should show "Ntp-4.1.2-0.rc1".
Step two: Install the NTP software, download the RPM package from ftp://ftp.redhat.com, and enter "Rpm-ivh ntp-xxx.rpm" to perform the installation.
Step three: Configure the NTP service. After backing up the original/etc/ntp.conf file, enter the following:
Server pool.ntp.org
Server pool.ntp.org
Server pool.ntp.org
Driftfile/etc/ntp/drift
The three-row server is pool.ntp.org to provide connectivity redundancy, and when the first address connection fails, the latter address provides the time service, noting that the pool.ntp.org here corresponds to a set of IP addresses, which are randomly assigned by DNS.
Fourth step: Start the NTP service. Enter "Service Ntprestart".
To ensure that the NTP service will start automatically after the Linux machine starts, enter "Chkconfig ntpd on". The NTP software under Linux can not only be automatically synchronized with the clock on the Internet, but it is already a SNTP server, which can be used for computer proofing time in LAN. It is recommended to manually correct the time with the date command after starting the NTP service, and the system will automatically synchronize with the main time server on the Internet. NTP service also has a benefit, if the current system time and standard time error, it is not immediately corrected time, but gradually reduce the error with the standard time, so as to avoid a time mutation within the system.
2, Windows2000, XP do time server
First step: Specify the primary time server. In DOS type "nettime/setsntp:pool.ntp.org", here we specify pool.ntp.org is the main time server, can also be a different address.
Step two: Start synchronizing with the main time server. Turn off the Windows Time service before you open the service. It can be done under the "services" interface of "Administrative Tools", or "Netstop w32time", "net start W32Time" can be entered in DOS.
Step three: Set the computer's Windows Time service to start automatically. Complete in the "services" interface of the "Administrative Tools".
Note This Windows host cannot join any domain, or the Windowstime service cannot be started. At this point, the Windows computer is already the client of the main time server on the Internet, and each time the computer starts, it will automatically proofread with the main time server. If the network does not pass, the computer will also automatically proofread the time after 45 minutes. It should be noted that the computer clock and standard Time error can not exceed 12 hours, or not automatically proofread, and manual correction.
Fourth step: Make this computer become a time server, for the computer proofing time inside the LAN. Open the registry with "regedit" and change the LOCALNTP in "Hkey_local_machinesystemcurrentcontrolsetservicesw32timeparameters" to 1.
3, Windows98 do time server
Windows98 system is generally not recommended to do time server, and Win98 itself does not include the time server function, need to install third-party software. The NetTime Software (http://nettime.sourceforge.net/), which is described later in this article, is a very good time client software that works in Windows98, 2000, and XP Systems and is elected "allow other Computers to sync to this computer, you can take this computer as a time server.


V. Setting up a client for a time server
The client's primary task is to connect to a time server within the LAN to keep the computer's clock synchronized with the server. Similar to Linux, Windows98, 2000, XP several situations
1. Linux Host
In fact, in the above described in the Linux system NTP service, already mentioned NTP time service is also a Time service client, as long as the "server Pool.ntp.org" in the/etc/ntp.conf file is changed to "Server internal time server IP address To If you do not want to use the NTP service, you can also use the Ntpdate command in the NTP package, as long as you manually execute the "Ntpdate Time server IP address". If you want to do the automatic daily, you can put this command in Cron, note that the NTP service on the same computer and the Ntpdate command cannot be used at the same time.
2. Windows2000 Host
Perform the first three steps when setting up a time server
3. WindowsXP Host
You can either press the Windows2000 host method setting, or you can double-click the clock icon in the lower-right corner of the taskbar to open the DateTime Properties dialog box and select Automatically synchronize with Internet time server on the Internet time card. and fill the server with the IP address of the internal time server.
4. Windows98 Host
Need to install third-party software, free software nettime is a good software, it supports SNTP (UDP123), Time (TCP37), TIME-UDP (UDP37) three methods of synchronization. Software operation is simple, as long as in the "Hostname or IP Address" entered the LAN time server IP addresses, "Protocol" select SNTP can be.
  of course, executing "net time machine name or IP address/set/yes" on a Windows98 computer may also synchronize clocks with other Windows computers , provided they are in the same network segment and have a NetBIOS protocol installed. Put the command in the Autoexec.bat, you can do the boot automatically.

Related Article

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.