# NetworkManager-wait-online.service doesn't wait for DNS

## KShots

I am running systemd and have a static IP setup via NetworkManager on my headless server. NetworkManager sets up the network properly, but I cannot get systemd to wait for the network to be up and running before it goes about starting up services. I have run the following to attempt to get NetworkManager to only declare the network is up and running when it is actually up and running, but it appears to not work:

```
systemctl enable NetworkManager-wait-online
```

Every time I boot, ntpdate fails to look up its time servers:

```
Feb 04 11:45:41 madusa.warfaresdl.com ntpdate[320]: Error resolving ntp1.warfaresdl.com: Name or service not known (-2)

Feb 04 11:45:41 madusa.warfaresdl.com ntpdate[320]: 4 Feb 11:45:41 ntpdate[320]: Can't find host ntp1.warfaresdl.com: Name or service not known (-2)

Feb 04 11:45:41 madusa.warfaresdl.com ntpdate[320]: 4 Feb 11:45:41 ntpdate[320]: no servers can be used, exiting

Feb 04 11:45:41 madusa.warfaresdl.com systemd[1]: ntpdate.service: main process exited, code=exited, status=1/FAILURE

Feb 04 11:45:41 madusa.warfaresdl.com systemd[1]: Failed to start Set time via NTP using ntpdate.

Feb 04 11:45:41 madusa.warfaresdl.com systemd[1]: Unit ntpdate.service entered failed state.
```

ntp1.warfaresdl.com resolves properly when I log into the system. Furthermore, although ntpd runs, I see the following in journalctl:

```
Feb 04 11:45:51 madusa.warfaresdl.com ntpd[378]: getaddrinfo: "ntp1.warfaresdl.com" invalid host address, ignored

Feb 04 11:45:51 madusa.warfaresdl.com ntpd[378]: restrict: error in address 'ntp1.warfaresdl.com' on line 46. Ignoring...

Feb 04 11:45:56 madusa.warfaresdl.com ntpd[378]: getaddrinfo: "ntp2.warfaresdl.com" invalid host address, ignored

Feb 04 11:45:56 madusa.warfaresdl.com ntpd[378]: restrict: error in address 'ntp2.warfaresdl.com' on line 48. Ignoring...
```

... which causes me to believe that ntpd may be running, but it won't do anything useful. I've tried adding the following to /etc/systemd/system/ntpdate.service.d/00gentoo.conf:

```
[Unit]

Wants=network.target

After=network.target

[Service]

Environment="SERVER=ntp1.warfaresdl.com ntp2.warfaresdl.com"
```

I also added the following to /etc/systemd/system/NetworkManager-wait-online.service.d/NetworkManager-wait-online.conf:

```
[Service]

ExecStart=/usr/bin/sleep 5
```

... which unfortunately does not resolve the problem. What more can I do?

----------

