# ntp running but not working

## hadees

my ntp isn't working for some reason, i have everything set up correctly though, at least i thought so but my clock is like 7 mins fast, after I ran /etc/init.d/ntp-client start i was able to get it back in sync.

Here is my ntp.conf file

```
# NOTES:

#  - you should only have to update the server line below

#  - if you start getting lines like 'restrict' and 'fudge'

#    and you didnt add them, AND you run dhcpcd on your

#    network interfaces, be sure to add '-Y -N' to the

#    dhcpcd_ethX variables in /etc/conf.d/net

# Name of the servers ntpd should sync with

# Please respect the access policy as stated by the responsible person.

#server         ntp.example.tld         iburst

#server pool.ntp.org

##

# A list of available servers can be found here:

# http://www.pool.ntp.org/

# A good way to get servers for your machine is:

# netselect -s 3 pool.ntp.org

##

# you should not need to modify the following paths

driftfile       /var/lib/ntp/ntp.drift

#server ntplocal.example.com prefer

#server timeserver.example.org

server ntp.fnbhs.com

server ntp.cox.smu.edu

server ntp-2.ece.cmu.edu

server ntppub.tamu.edu

# Warning: Using default NTP settings will leave your NTP

# server accessible to all hosts on the Internet.

# If you want to deny all machines (including your own)

# from accessing the NTP server, uncomment:

#restrict default ignore

# To deny other machines from changing the

# configuration but allow localhost:

restrict default notrust nomodify

restrict 127.0.0.1

# To allow machines within your network to synchronize

# their clocks with your server, but ensure they are

# not allowed to configure the server or used as peers

# to synchronize against, uncomment this line.

#

#restrict 192.168.0.0 mask 255.255.255.0 notrust nomodify notrap
```

Here is what 'ntpq -pn' prints out

```

     remote           refid      st t when poll reach   delay   offset  jitter

==============================================================================

 209.144.20.76   .RSTR.          16 u    -  256    0    0.000    0.000 4000.00

 128.2.129.21    .RSTR.          16 u    -  128    0    0.000    0.000 4000.00

 128.194.254.9   .RSTR.          16 u    -  128    0    0.000    0.000 4000.00

```

if I am missing anything that would help diagnosis this problem please tell me an I will post it right away

Thanks

----------

## angoraspruce

Hello hadees,

One possibility is that when you launch 'ntpd,' your clock is more than the permitted time out of sync, in which case the ntpd process will terminate.  I believe the maximum amount is only something like 30 seconds.  You could set the time with 'ntpdate', then launch 'ntpd'.  See if that does it.

HTH  :Smile: 

----------

## Arainach

From the Gentoo Install guide, put this line in your dhcpd.conf:

```
# If you intend on using NTP to keep your machine clock synchronized, use

# the -N option to prevent dhcpcd from overwriting your /etc/ntp.conf file

dhcpcd_eth0="-N"
```

----------

## lookinin

Good point Arainach, you can also try renaming or removing your /etc/adjtime - that might get rid of your time variance, but I'd still run the ntp-client initscript at boot just to be on the safe side.

Sometimes it takes a few minutes for the ntpd to decide the servers you've chosen are okay (not sure exactly why - think it was in the faq), so let it run for an hour or so, and come back and run "ntpq -pn" again to see if the output is different.  If not, try different servers, or a pool.ntp.org server that's close to you.

----------

## nobspangle

your box isn't hitting the servers, you should have an output like this

```
     remote           refid      st t when poll reach   delay   offset  jitter

==============================================================================

*192.168.69.10   130.88.200.6     3 u  213  512  377    0.484   -0.968   0.003

```

You only need to run ntp as a daemon if your box is on all the time. Otherwise just use ntp-client.

----------

## think4urs11

Hi!

Your problem lies here

```
209.144.20.76   .RSTR.
```

```
# To deny other machines from changing the

# configuration but allow localhost:

restrict default notrust nomodify

restrict 127.0.0.1 
```

Either comment out the restrictions or set them correct for the ntp servers you're using

HTH

T.

----------

## toralf

Here is a working conf:

```

nhh221 ~ # grep -v -e '^$' -e '^#' /etc/ntp.conf

driftfile       /var/lib/ntp/ntp.drift

restrict default ignore

restrict 127.0.0.1

logfile /var/log/ntp.log

server  ntp1.ptb.de

restrict ntp1.ptb.de noquery    noquery nomodify notrap

```

----------

## h0mer`-

...Last edited by h0mer`- on Sun May 15, 2005 10:37 pm; edited 1 time in total

----------

## h0mer`-

I did this (german) guide to setup my ntp server for a little network at home. Time synchs perfect on the gentoo machine but my windows xp clients keep saying "RPC server unavailable". I googled like hell but couldn't find an answer to solve my problem.... i also know its more a windows related question but maybe someone of you guys knows how to solve this.

----------

