LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Problem at startup with NTPD (https://www.linuxquestions.org/questions/linux-newbie-8/problem-at-startup-with-ntpd-501478/)

Dannt 11-14-2006 07:33 AM

Problem at startup with NTPD
 
Hi,

I am currently running Fedora Core 5 on my machine. My issue is that when I recently tried to make the system clock to syncrhonize at the bootup, but unfortunately when the machine is booting the NTPD always fails.

Does anyone knows what can be causing that? Any help would be appreciated..

Many thanks..

fordeck 11-14-2006 09:01 AM

Are you using a firewall? If you are you could try disabling it temporarily as root:

Code:

service iptables stop
then try as root:

Code:

ntpdate -u <timeserve_ip_address>
This should get a line with the current date and time. If this works then you would need to modify your iptables to allow port 123

Dannt 11-16-2006 06:14 AM

Dear Fordeck,

Sorry I haven't replied earlier and many thanks for your help..

I tried to disable the firewall and then update the clock with
Quote:

ntpdate -u <timeserve_ip_address>
and it worked perfectly showing the time. Then I tried to open the port 123 first I did with the TDP protocol, then with UDP, then with both together and I still receive a "failed" message at the startup.

Furthermore I disable the firewall completely and rebooted the machine to find out the problem was still there:

Synchronizing NTP: [failed]

I have been googgling for a while and everyone seems to point out that this is a firewall issue, but provided I rebooted the pc without it enabled, I am starting to think something else might be wrong.

Thanks anyway for your help, if you do have any other suggestion please let me know and I can try it.

Best

Dannt

fordeck 11-16-2006 07:07 AM

Could you post your /etc/ntp.conf file? I could take a look at it and see if there are any issues.

Dannt 11-16-2006 08:04 AM

Of course:

Quote:

# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.

restrict default nomodify notrap noquery

# Permit all access over the loopback interface. This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1


# -- CLIENT NETWORK -------
# Permit systems on this network to synchronize with this
# time service. Do not permit those systems to modify the
# configuration of this service. Also, do not use those
# systems as peers for synchronization.
# restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap


# --- OUR TIMESERVERS -----
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org


# --- NTP MULTICASTCLIENT ---
#multicastclient # listen on default 224.0.1.1
# restrict 224.0.1.1 mask 255.255.255.255 nomodify notrap
# restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap



# --- GENERAL CONFIGURATION ---
#
# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available. The
# default stratum is usually 3, but in this case we elect to use stratum
# 0. Since the server line does not have the prefer keyword, this driver
# is never used for synchronization, unless no other other
# synchronization source is available. In case the local host is
# controlled by some external source, such as an external oscillator or
# another protocol, the prefer keyword would cause the local host to
# disregard all other synchronization sources, unless the kernel
# modifications are in use and declare an unsynchronized condition.
#
fudge 127.127.1.0 stratum 10

#
# Drift file. Put this in a directory which the daemon can write to.
# No symbolic links allowed, either, since the daemon updates the file
# by creating a temporary in the same directory and then rename()'ing
# it to the file.
#
driftfile /var/lib/ntp/drift
broadcastdelay 0.008

#
# Keys file. If you want to diddle your server at run time, make a
# keys file (mode 600 for sure) and define the key number to be
# used for making requests.
#
# PLEASE DO NOT USE THE DEFAULT VALUES HERE. Pick your own, or remote
# systems might be able to reset your clock at will. Note also that
# ntpd is started with a -A flag, disabling authentication, that
# will have to be removed as well.
#
keys /etc/ntp/keys
restrict 0.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
restrict 1.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
restrict 2.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery

tredegar 11-16-2006 08:55 AM

Quote:

Furthermore I disable the firewall completely and rebooted the machine to find out the problem was still there:

Synchronizing NTP: [failed]
...So it is not a firewall problem!

At what stage in the boot process are you calling "ntpdate -u <timeserve_ip_address>" ? Maybe it is being called too soon (eg before networking is up).

I think I recall I had a similar problem when I first tried setting up ntp (and as I recall, I was trying to call it from /etc/rc.d/rc.local), and I worked around it like this:

I set up a cron job to call a script called "checkthetime" every hour. This script checks to see if ntp has synced my clock today. If it hasn't, it does. This has the advantage that I don't have to do a reboot to sync the time, and I am not calling the ntp servers unnecessairly often.

HTH

Dannt 11-16-2006 09:43 AM

Thanks Tredegar,

I think I realise what is happening clearer now, sorry if I didn't understood this first, but unfortunatelly more than 10 years using M$ Windows has dumbed me down to this point.

My computer connects to the Internet using a wireless card, and it is only after I log in into my user account when the Network Manager asks me to introduce the password for the keyring that holds the Wireless Network Key, and I have to do this everytime I log in any user account, so I believe there is not Internet connection before this.

Do you know by chance any way to prevent this keyring asking me for this password everytime I start? it isn't really necesary and from my point of view it is a waste of time. Otherwise I will find out how to do an script like the one Tredeger described.

Many thanks

tredegar 11-16-2006 10:06 AM

Glad you have realised where the problem lies!
Sorry, I do not use wireless, and am running KDE anyway, so cannot help you with "Network Manager". In KDE I would go to System Settings -> Network Settings, Select "Administrator Mode", give password, then R-click on my wireless interface, choose "Configure" and enter my ESSID / WEP keys (if I had them!). Surely there must be something similar for gnome.

Then you can play with cron and scripts (this was my first customise-linux-my-way project). I'll happily post my simple ntp script and crontab entry if this would help you.

fordeck 11-16-2006 10:41 AM

I believe you can modify /etc/sysconfig/network-scripts/ifup-wireless with your key to automate your wireless startup. You could also add the following to the bottom of the file:

Code:

/usr/sbin/ntpdate uk.pool.ntp.org
  if [ -x /etc/init.d/ntpd]; then
    /etc/init.d/ntpd restart
  fi

Your /etc/ntp.conf looks like the default. Might I suggest that you use time servers in your region. Perhaps the following servers could replace

"# --- OUR TIMESERVERS -----" section of /etc/ntp.conf:

Code:

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

The iptables rules below may work for you:

Code:

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 123 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 123 -j ACCEPT

Let me know if that helps?

Dannt 11-24-2006 10:03 AM

Dear Fordeck

Firstly I wanted to apologise for not having post a reply since last week, finally I managed to solve the issue following your advise and editing the ifup-wireless script, so many thanks for your help.

I moved on now onto a new chalenge challenge; get the wireless card in Ubuntu.

Thanks for your help


All times are GMT -5. The time now is 04:16 PM.