Sync to time server
I am running a Linux server. I use it as a gateway/firewall. I would like to have it sync it's clock to a time server on the internet once a day. Is there a way to do this?
Brian
Linux
I am running a Linux server. I use it as a gateway/firewall. I would like to have it sync it's clock to a time server on the internet once a day. Is there a way to do this?
Brian
on my redhat7 box, I use cron daily to sync the time. I did it an ugly way, so there will probably be better answers for you which will use NTP's full functionality.
I created a Cron Hourly job, which connects to a NTP server every hour, and corrects the time on my server. It's quick, it's easy. It works great. As indicated, there are probably better ways.
I created a file with the following 2 lines.
/usr/sbin/ntpupdate -b timelord.uregina.ca
/sbin/clock -w
The first line connects to a server which is fairly close to me (physically). and resets the time in the OS's system clock. The second line pushes the system clock time out to the BIOS.
I copied mine into /etc/cron.hourly and this causes it to run (obviously) everyhour. You'll want to copy yours to /etc/cron.daily, to have it run daily.
Try the first line (using a NTP source close to you) at the command line first. I found that several didn't succeed when I actually tried them.
My Windows 2000/Wintendo boxes all synchronize to that using the NET TIME command.
Kev.
by brianaaa12
by mckaytech
I use a program called xntpd (you can find it on RedHat v6.2 or earlier distribution but not on v7.0) and it works fine behind a firewall as long as the firewall is configured to permit the packets.
The machine running xntpd also serves as a timesource to the rest of my network and it works very nicely for that as well.
paul
by brianaaa12
Paul, do you think you could email me or direct me to some docs for that command? I did a "man" and there was no entry for the command, although the command did exist.
Thanks,
Brian
by brianaaa12
This discussion is closed to new replies.
Sort by Trending