LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   NTP Error. (https://www.linuxquestions.org/questions/linux-newbie-8/ntp-error-872334/)

Peter Tan 04-01-2011 04:58 AM

NTP Error.
 
Hello,

I am a newbie on linux. I am trying to fix this for 4 days but still unable to sync with the Internet time server.
I am trying to do synchronize to the internet time server using my internal server (running on redhat) but it does not work at all.
After configuring the ntp.conf, i stop the ntpd and start again and still did not work. i able to update the Internet time server using ntpdate commad.

Please comment on my configuration and show me show direction. :(

[root@app3 ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
LOCAL(0) .LOCL. 10 l 8 64 1 0.000 0.000 0.001


[root@app3 ~]# /etc/init.d/ntpd stop
Shutting down ntpd: [ OK ]

Configuration file:

Running on:
[root@app3 /]# /bin/bash --version
GNU bash, version 3.2.25(1)-release (i686-redhat-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.

I am able to update using ntpdate:
[root@app3 /]# ntpdate sg.pool.ntp.org
1 Apr 16:42:22 ntpdate[4812]: adjust time server 202.150.213.154 offset 0.036360 sec

Configuration file on /etc/ntp.conf

restrict default ignore
restrict 127.0.0.1

#allow synchronization sources from the internet servers
restrict server 3.sg.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
restrict server 0.asia.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
restrict server 2.asia.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery

#allow our internal server to synch to this server
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap noquery notrust

server 127.127.1.0 #local system clock
fudge 127.127.1.0 stratum 10
driftfile /etc/ntp/drift
logfile /var/log/ntp.log

acid_kewpie 04-01-2011 06:41 AM

you've not defined what servers to use at all. It looks like you've confused the server and restrict directives and fudged them into a single line.

The lines that will actually tell ntp to go get the time are:

server 0.asia.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org

or similar.

I would remove those restrict lines relating to those servers completely.

Peter Tan 04-03-2011 09:57 PM

Hi Acid,

I added the below entry:

#allow synchronization sources from the internet servers
server 2.sg.pool.ntp.org
server 0.asia.pool.ntp.org
server 2.asia.pool.ntp.org

and remove the below entry:
server 127.127.1.0 #local system clock
fudge 127.127.1.0 stratum 10


It worked perfectly. :)

may i know but what's wrong with the entry below
server 127.127.1.0 #local system clock
fudge 127.127.1.0 stratum 10

i need let the rest of my network server to sych to my local time clock if the internet time is down.

acid_kewpie 04-04-2011 02:17 AM

why did you remove those other lines? You should keep them. They mean that ntp will use itself as a reference if the others go down, see manpage for details.

Peter Tan 04-04-2011 02:53 AM

Hi Acid,

Initially when i configured it with :
server 127.127.1.0 #local system clock
fudge 127.127.1.0 stratum 10

I am not able to synch with the internet time server and i just found out, it is due to the internet time server down. :)
right now i am able to synch with the 3 internet time server, yahoo :)

192.168.1.8--------internal NTP network server.-------------------
restrict default ignore
restrict 127.0.0.1

#allow synchronization sources from the internet servers
server 2.sg.pool.ntp.org
server 0.asia.pool.ntp.org
server 2.asia.pool.ntp.org

#restict the type of access for each internet server
restrict 2.sg.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
restrict 0.asia.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
restrict 2.asia.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery

#allow our internal server to synch to this server
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap notrust

server 127.127.1.0 #local system clock
fudge 127.127.1.0 stratum 10

driftfile /etc/ntp/drift
logfile /var/log/ntp.log


Right now i had another issue, my internal network server(192.168.1.9 & 10) trying to synch with this local ntp server (192.168.1.8) could not work at all.is there something wrong with the config?

throw me :
# ntpdate -u 192.168.1.8
4 Apr 15:52:26 ntpdate[23031]: no server suitable for synchronization found

192.168.1.9 & 10--------internal client server.-------------------

server 192.168.1.8 prefer
restrict default ignore
restrict 127.0.0.1
restrict 192.168.1.8 mask 255.255.255.255 nomodify notrap noquery
driftfile /var/lib/ntp/drift


i followed the http://raghupathy.wordpress.com/2008...an-ntp-server/ steps:

Linux Client
To configure a Linux client to use the new server as a time source, the configuration file for the client should at least contain the following entries.

[bash]# vi /etc/ntp.conf
server 192.168.1.1
restrict default ignore
restrict 127.0.0.1
restrict 192.168.1.1 mask 255.255.255.255 nomodify notrap noquery
driftfile /var/lib/ntp/drift

Peter Tan 04-04-2011 03:01 AM

This is what i have done
# ntpdate -d 192.168.1.8
4 Apr 15:54:24 ntpdate[23032]: ntpdate 4.2.2p1@1.1570-o Sat Dec 19 00:58:17 UTC 2009 (1)
Looking for host 192.168.1.8 and service ntp
host found : db
transmit(192.168.1.8)
transmit(192.168.1.8)
transmit(192.168.1.8)
transmit(192.168.1.8)
transmit(192.168.1.8)
192.168.1.8: Server dropped: no data
server 192.168.1.8, port 123
stratum 0, precision 0, leap 00, trust 000
refid [192.168.1.8], delay 0.00000, dispersion 64.00000
transmitted 4, in filter 4
reference time: 00000000.00000000 Thu, Feb 7 2036 14:28:16.000
originate timestamp: 00000000.00000000 Thu, Feb 7 2036 14:28:16.000
transmit timestamp: d143f7b3.4e58f712 Mon, Apr 4 2011 15:54:27.306
filter delay: 0.00000 0.00000 0.00000 0.00000
0.00000 0.00000 0.00000 0.00000
filter offset: 0.000000 0.000000 0.000000 0.000000
0.000000 0.000000 0.000000 0.000000
delay 0.00000, dispersion 64.00000
offset 0.000000

somehow i understand that something is blocking in between but i able to ping from 192.168.1.9 to 192.168.1.8

acid_kewpie 04-04-2011 03:07 AM

ntpdate has NO relevance to your ntp.conf, that is for ntpd only. If you have ntpdate failing then there is either a network or server side issue.

Peter Tan 04-04-2011 04:27 AM

Hi Acid,

but how do i know that internal client server(192.168.1.9 & 10) is correctly synch the time with the
internal network sever (192.168.1.8) ?

At 192.168.1.9 & 10
i had ntpq -p 192.168.1.8

remote refid st t when poll reach delay offset jitter
==============================================================================
dyn107-b57-acce .INIT. 16 u - 1024 0 0.000 0.000 0.000
*ns.bio.keio.ac. 131.113.1.16 2 u 782 1024 377 87.127 -44482. 12.227
+CacheDNS-SBY.te 66.187.233.4 2 u 775 1024 377 401.304 -44476. 13.511
LOCAL(0) .LOCL. 10 l - 64 377 0.000 0.000 0.001

is it correctly synch with 192.168.1.8?

acid_kewpie 04-04-2011 07:40 AM

no, it's not configured to connect to it in ntpd.conf so why would it be? btw, use "ntpq -pn" to not use dns lookups. What' you've done in that ntpq command is get the status OF 192.168.1.8, not see if you're using it. And as the server does not respond to your ntpdate requests you're again clearly not gonig to get any time from it.

David the H. 04-04-2011 08:04 AM

Could you please edit your posts and place [code][/code] tags around your code? This will preserve formatting and to improve readability. In particular it will keep those long lines from forcing the page to scroll horizontally.


All times are GMT -5. The time now is 07:23 AM.