# Switched to wpa_supplicant, now ntp-client runs too soon

## engineermdr

I switched to using wpa_supplicant from wireless-tools and that's working fine.  But now during boot, wpa_supplicant goes off and connects in the background and when ntp-client starts, the network isn't up yet.  If I try and start ntp-client later after the network is up, all is well.  The ntp-client script has "need net"  in the depend section.  I can't find a way to fix this, apart from not running ntp-client at all.  Any suggestions?

----------

## smlgbl

Did you try putting wpa_supplicant into the "boot"-runlevel, and the ntp-client into the default-runlevel?

----------

## d2_racing

In fact, this can do the trick.

----------

## engineermdr

Do you guys mean put net.wlan0 into the boot runlevel?  That's how I believe wpa_supplicant is started.

----------

## d2_racing

Yes,

```

# rc-update add net.wlan0 boot

```

----------

## Devport

A better solution imho is to (re)start the ntp-client whenever a network connection is established - I have done it using /etc/conf.d/net :

```
postup() {

   [ "${IFACE}" != "lo" ] && /etc/init.d/ntp-client restart

}

```

I dont even start ntp-client at startup at all.

----------

## engineermdr

Thanks all.

Moving the start of net.wlan0 to the boot runlevel made no difference.  I removed it again from all runlevels and let coldplugging do its job.

I really like the postup() solution.  But after thinking about it I agree I don't even need to run ntp-client, my hwclock is accurate enough.

----------

## andron

Try to add this to /etc/conf.d/net.

```
associate_timeout_wlan0=60
```

Maybe this helps.

----------

