Activities

October 2010
M T W T F S S
« Sep   Nov »
 123
45678910
11121314151617
18192021222324
25262728293031

How do I setup Time server On Centos (NTP Server)

Some critical applications ( odesk) requires system time to be updated with the server time in order to work certain features. Also you will get some application will not able to install if the local time is out dated or older. Damaged BIOS batter also cause this to happen.

So I decided to install a Network Time server in LAN. Also I have added a cron or scheduler set on each workstation to communicate with this server and re-build our OS disk images.

Installing ntp using yum.

#yum install ntp*

# Modify the following lines

restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap</ul>
 #Changed  to my network
 #Added the following lines.
   server 192.168.0.1
   server 127.0.0.1
   fudge   127.0.0.1 stratum 10

Or you may replace the “/etc/ntp.conf” with following entries, This is my ntp config. file.

[root@rc-025 ~]# cat /etc/ntp.conf | sed '/ *#/d; /^ *$/d'
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap
driftfile /var/lib/ntp/drift
keys /etc/ntp/keys
server 192.168.0.1
server 127.127.1.0
fudge   127.127.1.0 stratum 10

3. Restart the ntpd service,

[root@rc-025 ~]# <strong>service ntpd restart</strong>
Shutting down ntpd:                                        [  OK  ]
Starting ntpd:                                             [  OK  ]

Verify the status,

[root@rc-025 ~]#netstat -nlp | grep ":123"
udp        0      0 172.16.11.1:123             0.0.0.0:*                               21156/ntpd
udp        0      0 172.16.23.1:123             0.0.0.0:*                               21156/ntpd
udp        0      0 192.168.0.1:123             0.0.0.0:*                               21156/ntpd
udp        0      0 192.168.0.41:123            0.0.0.0:*                               21156/ntpd
udp        0      0 192.168.0.25:123            0.0.0.0:*                               21156/ntpd
udp        0      0 127.0.0.1:123               0.0.0.0:*                               21156/ntpd
udp        0      0 0.0.0.0:123                 0.0.0.0:*                               21156/ntpd
udp        0      0 fe80::21c:c0ff:fea3:123     :::*                                    21156/ntpd
udp        0      0 fe80::250:56ff:fec0:1:123   :::*                                    21156/ntpd
udp        0      0 fe80::250:56ff:fec0:8:123   :::*                                    21156/ntpd
udp        0      0 ::1:123                     :::*                                    21156/ntpd
udp        0      0 :::123                      :::*                                    21156/ntpd
[root@rc-025 ~]#

Pls note that ntp uses UDP protocol. So that you can not test it using telnet command.

How to verify the NTP server is working, Go to client desktop,

The following commands shows it’s working,

[root@rc-090 SVN-Archive]#date -s "16:55:30 Jun 09, 1981"
Tue Jun  9 16:55:30 IST 1981
[root@rc-090 SVN-Archive]#date
Tue Jun  9 16:55:32 IST 1981
[root@rc-090 SVN-Archive]#ntpdate -u 192.168.0.1
15 Oct 14:58:31 ntpdate[18516]: step time server 192.168.0.1 offset 926200973.366843 sec
[root@rc-090 SVN-Archeive]# date
Fri Oct 15 14:58:33 IST 2010

-njoy 🙂

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>