Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

ntpd don't sync my pc[SOLVED]

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
8 posts • Page 1 of 1
Author
Message
larand54
l33t
l33t
User avatar
Posts: 695
Joined: Fri Feb 20, 2004 8:05 am
Location: Sweden

ntpd don't sync my pc[SOLVED]

  • Quote

Post by larand54 » Thu Oct 26, 2006 8:22 pm

It has worked perfect before but today I checked, it was running but had a difference about 40 seconds.

From /var/log/messages when it started:

Code: Select all

Oct 26 08:37:36 jupiter ntpd[8737]: ntpd 4.2.2p3@1.1577-o Wed Sep 20 10:13:50 UTC 2006 (1)
Oct 26 08:37:36 jupiter ntpd[8871]: precision = 1.000 usec
Oct 26 08:37:36 jupiter ntpd[8871]: Listening on interface wildcard, 0.0.0.0#123 Disabled
Oct 26 08:37:36 jupiter ntpd[8871]: Listening on interface lo, 127.0.0.1#123 Enabled
Oct 26 08:37:36 jupiter ntpd[8871]: Listening on interface eth0, 172.16.68.110#123 Enabled
Oct 26 08:37:36 jupiter ntpd[8871]: kernel time sync status 0040
Oct 26 08:37:37 jupiter ntpd[8871]: frequency initialized -42.056 PPM from /var/lib/ntp/ntp.drift

Code: Select all

# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 mars.hemma      193.10.7.246     2 u  621 1024    0    0.000    0.000   0.000

Code: Select all

# ps aux | grep ntp
ntp       8871  0.0  0.1   4304  1268 ?        Ss   08:37   0:00 /usr/sbin/ntpd -p /var/run/ntpd.pid -u ntp:ntp
/etc/ntp.conf

Code: Select all

 # cat /etc/ntp.conf
# Generated by dhcpcd for interface eth0
restrict default noquery notrust nomodify
restrict 127.0.0.1
restrict 172.16.68.1 nomodify notrap noquery
server 172.16.68.1
driftfile /var/lib/ntp/ntp.drift
logfile /var/log/ntp.log

Code: Select all

# cat /etc/conf.d/ntpd
# /etc/conf.d/ntpd

# Options to pass to the ntpd process
# Most people should leave this line alone ...
# however, if you know what you're doing, feel free to tweak
NTPD_OPTS="-u ntp:ntp"
Anyone have an idea?
Last edited by larand54 on Fri Oct 27, 2006 4:48 pm, edited 1 time in total.
Top
morodoch
Guru
Guru
User avatar
Posts: 523
Joined: Thu Sep 22, 2005 2:01 pm
Location: England

  • Quote

Post by morodoch » Thu Oct 26, 2006 8:26 pm

I'm guessing; but ntp doesn't sync the time if it doesn't think it's already close enough. Try stopping ntpd, running ntpdate to get an initial time, and then restarting ntpd:

Code: Select all

/etc/init.d/ntpd stop
ntpdate -b your.server.address
/etc/init.d/ntpd start
You can automate this using /etc/init.d/ntp-client.

HTH
Well, the Sister was right. You boys could use a little churching up. Slide on down to the Triple Rock, and catch Rev. Cleophus. You boys listen to what he's got to say.

-- Curtis
Top
larand54
l33t
l33t
User avatar
Posts: 695
Joined: Fri Feb 20, 2004 8:05 am
Location: Sweden

  • Quote

Post by larand54 » Thu Oct 26, 2006 8:52 pm

morodoch wrote:I'm guessing; but ntp doesn't sync the time if it doesn't think it's already close enough.
No I don't think so. Usually ntpd exits when this happends and I also think it should be much more difference.
morodoch wrote: Try stopping ntpd, running ntpdate to get an initial time, and then restarting ntpd:

Code: Select all

/etc/init.d/ntpd stop
ntpdate -b your.server.address
/etc/init.d/ntpd start
You can automate this using /etc/init.d/ntp-client.

HTH
Good idea :) but in my case ntpdate does not work:

Code: Select all

# ntpdate -b 172.16.68.1
26 Oct 22:36:34 ntpdate[17015]: no server suitable for synchronization found
It makes 4 conversions with the server and get correct data back from the server all times.

It's a mess :(
Top
morodoch
Guru
Guru
User avatar
Posts: 523
Joined: Thu Sep 22, 2005 2:01 pm
Location: England

  • Quote

Post by morodoch » Thu Oct 26, 2006 9:01 pm

Well I guess then it doesn't trust the clock on your server.

Try adding some more hosts to ntp.conf & your ntpdate command line - three hosts are good as it gives the ntp algorithms more to work with. Something like this?

Code: Select all

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

fudge 127.127.1.0 stratum 10
server 127.127.1.0
driftfile /var/lib/ntp/ntp.drift
This looks at three servers from the pool, but falls back to your local clock if none are suitable / available.
Well, the Sister was right. You boys could use a little churching up. Slide on down to the Triple Rock, and catch Rev. Cleophus. You boys listen to what he's got to say.

-- Curtis
Top
larand54
l33t
l33t
User avatar
Posts: 695
Joined: Fri Feb 20, 2004 8:05 am
Location: Sweden

  • Quote

Post by larand54 » Fri Oct 27, 2006 4:48 pm

Think I solved it by changing ntp.conf in the server:

Code: Select all

mars ~ # cat /etc/ntp.conf
#restrict 127.0.0.1 notrust nomodify notrap
restrict 127.0.0.1
restrict 172.16.68.0 mask 255.255.255.0  nomodify
restrict 192.168.0.0 mask 255.255.255.0  nomodify
server ntp1.sp.se
server ntp2.sp.se
server ntp1.mmo.netnod.se
server ntp2.mmo.netnod.se
server ntp1.sth.netnod.se
server ntp2.sth.netnod.se
server ntp1.gbg.netnod.se
driftfile /var/lib/ntp/ntp.drift
logfile /var/log/ntp.log
mars ~ #
As you can see there is a line commented i replaced it with the line below the commented line.

I also had to restart the server to re-read the config-file.
After a few minutes had the client up to sync again  :D 
I'm not too sure about how the restrict-option works but it seems that it had something to do with my problem. We'll see if I come back later :wink: 
Thank's for your help!
Top
morodoch
Guru
Guru
User avatar
Posts: 523
Joined: Thu Sep 22, 2005 2:01 pm
Location: England

  • Quote

Post by morodoch » Fri Oct 27, 2006 7:18 pm

No worries.

You may find that if you set up both machines to have pool entries as servers, then set each other as a peer, that your setup will be more resilient. If the net connectivity goes down for some reason, they'll use each other's clocks.
Well, the Sister was right. You boys could use a little churching up. Slide on down to the Triple Rock, and catch Rev. Cleophus. You boys listen to what he's got to say.

-- Curtis
Top
larand54
l33t
l33t
User avatar
Posts: 695
Joined: Fri Feb 20, 2004 8:05 am
Location: Sweden

  • Quote

Post by larand54 » Sun Oct 29, 2006 9:58 pm

Ok thank's,
I'm using dnsmasq on the same machine as I have the ntp-server also using dhcp through dnsmasq It is also configured to configure the clients. So I cannot setup the server and client as you propose without breaking this rule. Otherwise it sounds as a good idea. NTPD is rather powerful isn't it?
Top
morodoch
Guru
Guru
User avatar
Posts: 523
Joined: Thu Sep 22, 2005 2:01 pm
Location: England

  • Quote

Post by morodoch » Tue Oct 31, 2006 7:15 am

Yep. Designed by eggheads - have you seen the RFC?

http://www.eecis.udel.edu/~mills/database/rfc/rfc1305/

I didn't even try to understand it :)

The docs are much better now than they were, thank goodness.
Well, the Sister was right. You boys could use a little churching up. Slide on down to the Triple Rock, and catch Rev. Cleophus. You boys listen to what he's got to say.

-- Curtis
Top
Post Reply

8 posts • Page 1 of 1

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic