faq
search
add article
cool-stuff
how-to
main
tips
|
Posted by Understudy on Saturday May 11, @04:12PM
from the rock around the clock dept.
In my conversion from windoze to FreeBSD one of the things I wanted was the ability to keep my clocks in synch. With windoze you download a program and load it. With FreeBSD you have it built in and you just turn it on. Welcome to the world of ntp.
Okay lets keep things simple here. You want to sound smart when you talk about FreeBSD. Here is an easy one. NTP stands for Network Time Protocol. Fancy smancy. It means keeping the time right on your FreeBSD box. With windoze you could download Atomic Clock Sync or it's equavilent. The program ran in the background and kept you box accurate. Provided your CMOS battery wasn't shot. With FreeBSD you turn on NTP. This is basically the same thing. You can set it up to run at startup and maintain itself throughout the day.
As root do this:
# ee /etc/ntp.conf
The "ee" brings up "Easy Editor". It is easy straight forward and doesn't scare or trap me like vi does. Think of Easy Editor as FreeBSD's version of notepad. /etc/ is the directory (folder) we are putting the ntp.conf file in. All that with one short line. Nice.
It probably opened and said new file. That is ok. Type in the following lines:
server ntp.demon.nl
server ntp.demon.co.uk
driftfile /var/db/ntp.drift
Hit the Esc ( Escape ) button then press the Enter button it will prompt you to save the changes. You do that by pressing Enter again. Now that file has told it which servers it wants to talk to when trying to confirm the time. You can use others. Here is a list. Find some near you. Now we would like the program to work.
# ee /etc/rc.conf
The rc.conf is kinda like a startup file is to windoze. It tells programs to run when the computer starts.When you edit this file it probably already has stuff in it. Press Ctrl and u at the same time. It will take you to the bottom line of the file. You will then after that last line want to add the following lines.
ntpdate_enable="YES"
ntpdate_program="ntpdate"
ntpdate_flags="-bs ntp.demon.nl ntp.demon.co.uk"
xntpd_enable="YES"
xntpd_program="ntpd"
Do the Esc+Enter+ Enter that you did earlier. This has saved the file and the next time you restart your FreeBSD box you will be good to go. Restart like in windoze only this time because you are modifying the rc.conf and for those changes to register FreeBSD must restart. You can restart FreeBSD like this:
# shutdown -r +3
Basically you have told FreeBSD to "shutdown", the "-r" tells it to reboot "+3" tells it to do it in 3 minutes. You can adjust the time simply by changing the number after the "+" symbol. If you want to shutdown right away you replace "+" with "now". It is usually nice to give it a minute or two to shutdown but that is my preference.
References:
FreeBSD Handbook
Howto
Important Stuff:
Note: Fields with bold titles are required.
Please try to keep posts on topic.
Try to reply to other people comments instead of starting new threads,
Read other people's messages before posting your own to
avoid simply duplicating what has already been said.
Use a clear subject that describes what your
message is about.
Please do not post offtopic, inflammatory, inappropriate, illegal,
or offensive comments. Repeat offenders will be sanctioned.
|