help with NTP
Hi All,
i am sending my first questing on such forum. i am using broadcom router . when some one set time server name in time settings field in router what kind of settings we have to do so that system get time(sync with that) from that particular server. i have already get very good answer from this forum so i know i get very good answer which help me a lot. your help is appreciated. |
If you have a time server on your network -- a machine that is synchronized with a time source such as a GPS clock, radio clock, or external time source such as a national time service -- all you need to do is set the address of that server in the /etc/ntp.conf file.
For example, if your time server's address is 192.168.1.10, the entry in your /etc/ntp.conf file would look something like this Code:
server 127.127.1.0 # local clock You may want to add a couple of external pool servers to the entry; they of the form Code:
server 0.cc.pool.ntp.org The router you're using does not need any special settings as long as your local server can "see" the time server, you're good to go. If you have set up your LAN to require some sort of port access or the like, you may need to open that port on the router, but that would probably be unusual. And, finally, if the time server has a "name" it also has an address -- you need to know the address to make the entry in /etc/ntp.conf. The example I've used above, 192.168.1.10, is a reserved for private network address (the 192.168.x.x) and you will need to use your LAN address. If you make any changes to /etc/ntp.conf, you will need to stop and restart the NTP daemon. Also, if your local clock is not close to the correct time, NTP will not sync so you may need to stop the NTP daemon and use the ntpdate utility to set your local clock before starting the NTP daemon; e.g., Code:
ntpdate address_of_time_server |
thanks a lot for your quick reply
this helps me a lot but i want to know what is a use of "fudge". now as i understand from your reply when someone add time_server_name in time setting field of router page(web page) then i have to add server time_server_name instead of server 192.168.1.10 in ntp.conf file and then ntpd stop am i right. your help is appreciated. |
Maybe, maybe not: if your system "knows" time_server_name by name; i.e., you can open a terminal window and ping time_server_name (obviously using the name of the server, not "time_server_name"), then, yes, you can use the name. It might be better, if the time server is using fixed IP addressing; i.e., the address of the server never changes, then if you use the actual address then the name doesn't have to be resolved. That means that your system does not have to contact a DNS server to get the address from the name (if you ping the server by name, the display will show you the address, for example)
Code:
prompt: ping -c 6 0.us.pool.ntp.org In the example I gave you, using a couple of pool servers in addition to your time server, I don't know their addresses and one of the truly nice things NTP does when you give it three or so time servers (the pool servers in this case) is that it will determine the best time server to use and switch from one to another if for some reason the initial choice drops out or becomes slower than one of the others. When you have an actual time server on your LAN, it's most likely going to be the closest electrically (that is the ping time is the shortest) and NTP will synchronize with it all the time. The idea of having external pool servers available is that if you LAN time server goes away for some reason (system maintenance, the LAN goes down, the phase of the moon, whatever) there are one or two external servers to back it up just in case. So, you can make your entry either way -- name or address. If you can ping the name, that'll work (and might be better if the server is not using fixed IP addressing). LAN time servers typically do not use DHCP addressing but, if yours does, then you want to use the server name because the address may change periodically. And, once you've made your entries, stop NTPD then start NTPD. After about five minutes you can see if you're sync'd up by executing ntpq like this Code:
prompt ntpq -p Hope this helps some. |
thanks a lot.
this is very good reply for me. now i want to know what is difference between ntpdate and ntpd? can it possible to do the whole task of NTP by using only ntpdate if i don't want to use ntpd. because i have to change my linux system time whenever someone change time server name in router time setting (web page) page. and also i have to execute cronjob of this time synchronization 1 time in a day. i expect same more knowledgeable answer from you. i am actually learning from your answer day to day. |
The ntpdate utility is a one-time set-the-clock-from-a-time-server. The daemon, ntpd, keeps the system clock synchronized with with a time reference (national time servers, GPS clocks and the like -- they're all referenced is to the so-called atomic clocks maintained around the world).
The clocks in computer systems are notorious for drifting, gaining and losing time. You'd think, what with wristwatches being as accurate and cheap as they are, that it wouldn't be too much trouble to keep accurate time in a computer but that just isn't the case (for a lot of reasons that I'll leave to you to discover). Essentially, your system clock will drift and it needs to be adjusted periodically to get it back in sync with the reference standard. That's what the NTP daemon does (and that's a Good Thing: networks and things work a little better if they're all on the same time). It is unlikely that your network time server is going to change addresses; when a LAN time server is set up, the whole idea of doing so is to provide a time reference for all the computers attached to the LAN to keep them all in sync. You just don't fiddle with it once it's in place. And, when the time server system is rebooted or whatever it will only be out of service for a short period -- the beauty of NTP is that sort of thing is taken into account. If your network connection goes away or your LAN time server goes away, NTP will simply fall back to LOCAL (the internal clock) if the network drops off or to one of the pool servers you add to /etc/ntp.conf. When your LAN time server comes back, NTP automagically switches back to it and syncs your system. It's invisible, it's automatic and it requires no action on your part -- this is also a Good Thing. Of course you can, if you choose, not use the daemon at all. You could set up a cron job to execute ntpdate once every X hours and that would keep your system clock pretty much on time. But you need to figure out how to set up the cron job, test it, check every so often to make sure that it's running and all that; why bother? You have a time server available, you can access pool servers to back that up and you don't have to fiddle with anything. The NTP daemon uses an insignificant amount of resources (you'd be hard-pressed to notice it), it works so you don't have to. Hope this helps some. |
thanks a lot this helps me a lot.
|
All times are GMT -5. The time now is 05:00 AM. |