# NTPd fails to sync when DNS used



## gustopn (Jul 28, 2019)

Hi, I have a freshly updated
`12.0-RELEASE-p8 FreeBSD 12.0-RELEASE-p8 r350387 GENERIC  amd64`
where NTPd stopped working saying:

```
Jul 28 14:32:28 wasp ntpd[1194]: giving up resolving host ntp1.hetzner.de: servname not supported for ai_socktype (9)
Jul 28 14:32:28 wasp ntpd[1194]: giving up resolving host ntp2.hetzner.com: servname not supported for ai_socktype (9)
Jul 28 14:32:28 wasp ntpd[1194]: giving up resolving host ntp3.hetzner.net: servname not supported for ai_socktype (9)
```
the workaround was to resolve the names for it (since resolving works, only NTPd seems to have a problem with this):
`grep ^server /etc/ntp.conf`

```
server 213.239.239.164      iburst
server 213.239.239.165      iburst
server 213.239.239.166      iburst
server 2a01:4f8:0:a0a1::2:1 iburst
server 2a01:4f8:0:a112::2:2 iburst
server 2a01:4f8:0:a101::2:3 iburst
```

On -STABLE there seems to be no issue:
`12.0-STABLE FreeBSD 12.0-STABLE r349848 GENERIC  amd64`
`grep ^server /etc/ntp.conf`

```
server  ntp1.hetzner.de  iburst
server  ntp2.hetzner.com iburst
server  ntp3.hetzner.net iburst
```
`ntpq -pnw`

```
remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*2a01:4f8:0:a0a1::2:1
                 124.216.164.14   2 u  134  256  377    2.685    0.992   0.759
+2a01:4f8:0:a112::2:2
                 124.216.164.14   2 u   81  512  377    0.360    1.456   0.767
+2a01:4f8:0:a101::2:3
                 205.46.178.169   2 u   44  512  377    0.369   -0.251   0.574
```


----------



## SirDice (Jul 29, 2019)

For some reason ntpd(8) was started before the network was active. This resulted in the botched name lookups. You can try to use SYNCDHCP if you use DHCP or use `netwait` to make sure the network is active before continuing the boot process.


----------



## gustopn (Jul 31, 2019)

OK, then why it does the same, when you run `service ntpd restart`?


----------

