Wednesday, November 2, 2011

Linux Debian NTP Time Server

To provide a time server (ntp server) for internal network is very simple:

#su
enter your password




To install the ntp server software:
#apt-get install ntp ntpdate

then edit the configuration file:
#nano /etc/ntp.conf

On file, change only this settings:

For all clients, for example, on range - 192.168.110.0 - 255 have access.

# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
restrict 192.168.110.0 mask 255.255.255.0

In this line put your reliable external ntp server. Just search google for a good one.
In this case i'am using the legal time server in Portugal. The Astronomical Observatory of Lisbon is the provider of correct time. The Time zone is WET (Western Europe Time) with +00:00 hours of time zone offset. http://www.oal.ul.pt/

There is another one the NTP Pooling Project located at http://www.pool.ntp.org.
The NTP Pool is a collection of over 220 NTP servers distributed over the world.

# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines. Please do this only if you trust everybody on the network!
#disable auth
#broadcastclient
server ntp02.oal.ul.pt
server ntp04.oal.ul.pt


safe (control + x, and yes to save) and exit.
To update time on server just do this:

#ntpdate ntp02.oal.ul.pt

restart service
#/etc/init.d/ntp restart

then:
#ntpq -p

That's it!

To configure client:
On Linux client go to Gnome "date and time" and put the ip of your server.
On OSX open "system preferences", then date & time and put the ip of your server.
On Windows go to "date & time" on control panel and put the ip of your server under internet time.

Simple!

No comments:

Post a Comment