You are not logged in.

#1 2009-03-28 20:35:21

Rorschach
Member
From: Ankh-Morpork
Registered: 2008-11-07
Posts: 143

openntpd and no internet connection while start problem

Hi,
I have a little problem. My wlan-driver gets loaded before openntpd starts. But it takes some time until the network connection is ready and most of the time, when openntpd is started, it isn't ready yet ready.

This seems to make openntpd sleep. It's still running but it does nothing. Also if the internet connection starts later, openntpd needs to be restarted to start working.

Is there any workaround or patch for the problem?

Offline

#2 2009-03-28 21:18:27

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: openntpd and no internet connection while start problem

Depends on how you connect to the internet. I have net-profiles in daemons before openntpd and I don't start net-profiles in the background, so I am definitely online before openntpd starts. Same with wicd when I used that.

Offline

#3 2009-03-28 21:41:46

Rorschach
Member
From: Ankh-Morpork
Registered: 2008-11-07
Posts: 143

Re: openntpd and no internet connection while start problem

I connect with my rc.local:

#!/bin/bash
#
# /etc/rc.local: Local multi-user startup script.
#
/usr/sbin/wpa_supplicant -B -Dwext -iwlan0 -c /etc/wpa_supplicant.conf 2>1 /dev/null &
/sbin/dhcpcd wlan0 2>1 /dev/null &

But it doesn't matter how I start openntpd, if I start it with rc.d oder also in the rc.local the problem exists on both variants.

I think openntpd should check from time to time if there's connection or not.

Offline

#4 2009-03-28 22:13:47

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: openntpd and no internet connection while start problem

You shouldn't drop that stuff in rc.local. Install netcfg and tell it to leave authentication to wpa_supplicant:

[stijn@hermes ~]$ cat /etc/network.d/intel 
CONNECTION="wireless"
INTERFACE="intel"
HOSTNAME="hermes"

# AP authentication
SCAN="yes"
SECURITY="wpa-config"
WPA_CONF="/etc/wpa_supplicant.conf"
WPA_OPTS="-Dwext -B"
ESSID="xxxxxxxxxxxxx"

# IP address
IP="dhcp"
DHCP_TIMEOUT=10

That works fine over here.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#5 2009-03-29 10:09:54

Rorschach
Member
From: Ankh-Morpork
Registered: 2008-11-07
Posts: 143

Re: openntpd and no internet connection while start problem

Hi B,
thanks for the hint to netcfg. I created now a profile but have a little question about it: Is it possible to make netcfg first check if there's a link at eth0 and just if this fails trying to connect via wireless?

I created to profiles: one for ethernet and one for wireless but how can I realise the above things?

Offline

#6 2009-03-29 19:22:39

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: openntpd and no internet connection while start problem

I think netcfg has a way to present you an (ncurses-based I guess) interactive menu at boot so you can choose which connection to activate at boot. I don't know of a way to switch to another when the first one does not work, though. You could script something for that maybe and dump it in rc.local. Frankly I just set my wireless to active and all it needs for the Ethernet interface to bring up is an ifconfig $interface $IP or a dhcpcd -n $interface.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#7 2009-03-30 13:52:52

X/ax
Member
From: Oost vlaanderen, Belgium
Registered: 2008-01-13
Posts: 275
Website

Re: openntpd and no internet connection while start problem

My "solution" to the problem is using a wpa start script in rc.d:

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

case "$1" in
  start)
    stat_busy "Starting WLAN"
    wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -B
    dhcpcd wlan0 -t0
    if [ $? -gt 0 ]; then
      stat_fail
    else
      /etc/rc.d/openntpd start
      add_daemon wpa
      stat_done
    fi
    ;;
  stop)
    stat_busy "Stopping WLAN"
    pkill wpa_supplicant
    pkill dhcpcd
    if [ $? -gt 0 ]; then
      stat_fail
    else
      rm_daemon wpa
      stat_done
    fi
    ;;
  restart)
    $0 stop
    sleep 1
    $0 start
    ;;
  *)
    echo "usage: $0 {start|stop|restart}"  
esac
exit 0

The script itself is ripped from somewhere, don't remember.
Notice the "/etc/rc.d/openntpd start" line.
It's a simple hack, albeit it's probably not the most elegant... It works smile


My coding blog (or an attempt at it)
Archer start page (or an attempt at it)

Offline

Board footer

Powered by FluxBB