# ntpdate won't find server on boot,



## Roald (May 28, 2019)

Hello, Firewall is disabled, and i can manually set the correct date/time with:
# ntpdate -u 0.nl.pool.ntp.org

However, when i start the laptop with /etc/rc.conf:

```
ntpd_enable="YES"
ntpdate_enable="YES"
ntpdate_hosts="0.nl.pool.ntp.org"
```

to sync the date/time on boot i get:

```
28 May 22:15:51 ntpdate[66751]: no server suitable for synchronization found
```

So it seems that the -u option when setting date/time manually  is making the difference, from the manpage:

```
-u         Direct ntpdate to use an unprivileged port    for outgoing packets.
         This is most useful when behind a firewall    that blocks incoming
         traffic to    privileged ports, and you want to synchronise with
         hosts beyond the firewall.     Note that the -d option always    uses
         unprivileged ports.
```

How can i make ntpdate sync on boot?


----------



## Minbari (May 28, 2019)

Roald said:


> Hello, Firewall is disabled, and i can manually set the correct date/time with:
> # ntpdate -u 0.nl.pool.ntp.org
> 
> However, when i start the laptop with /etc/rc.conf:
> ...




```
ntpd_enable="YES"
ntpd_sync_on_start="YES"
ntp_leapfile_fetch_verbose="YES"
ntpdate_enable="YES
```


----------



## Roald (May 28, 2019)

when i set in /etc/rc.conf

```
ntpd_enable="YES"
ntpd_sync_on_start="YES"
ntp_leapfile_fetch_verbose="YES"
ntpdate_enable="YES
```

i still get:

```
28 May 22:15:51 ntpdate[66751]: no server suitable for synchronization found
```
Not sure, i think that my ISP is blocking port udp 123 that ntpdate is using:

```
# ntpdate 0.nl.pool.ntp.org
28 May 22:47:11 ntpdate[52644]: the NTP socket is in use, exiting
```
when using the -u flag, ntpdate works fine and returns:

```
28 May 22:5447 ntpdate[52876]: step time server xxxxxx offset 320 121580 sec
```

If i'm correct the ntpdate port can not be changed?
So i thought about htpdate package that seems to use port 80, but the question is: How can i make htpdate sync at boot ?


----------



## Roald (May 28, 2019)

*edit*
when using htpdate and set /etc/rc.conf:
htpdate_enable="YES"
then when i manually set the wrong time to test, reboot the laptop, when the system is back up i get display with the wrong time. However when i log in with root, the time syncs to the correct time. :S
So i guess i got what i want, only weird the time can't be synced at boot, only after login.


----------



## phoenix (May 28, 2019)

Could also be that it's trying to run ntpdate before the network link is established and working.  Pretty hard to query a server on the Internet without an Internet connection.

Read through rc.conf(5) man page, paying attention to the *netwait* options.  That will pause the boot process until you have a working network connection.


----------

