View previous topic :: View next topic |
Author |
Message |
lelik Tux's lil' helper
Joined: 26 May 2005 Posts: 81 Location: Treasure Island
|
Posted: Thu Oct 09, 2008 2:39 am Post subject: Wireless using local at default level, how at boot level? |
|
|
Wrote a small script to bring my wireless up using wpa_supplicant. Tested manually and it works fine.
Put the script to /etc/conf.d/local.start and added local to my default runlevel.
gives
Code: |
alsasound | boot
bootmisc | boot
checkfs | boot
checkroot | boot
clock | boot
consolefont | boot
dbus | default
fbcondecor | boot
hald | default
hostname | boot
ivman | default
keymaps | boot
local | default nonetwork
localmount | boot
metalog | default
modules | boot
net.lo | boot
netmount | default
ntp-client | default
openvpn | default
rmnologin | boot
urandom | boot
vixie-cron | default
xdm | default |
Now at boot it starts my wireless (eth2, don't ask me why), and tries scanning for a suitable wireless router. Finds nothing, and issues an error: failed to configure wireless for eth2. Also my ntp-client fails as well as there is no network. System continues booting and at some point local kicks in and I get my wireless. At that point, if I issue ntpdate manually it will obviously work.
Now the question is how get use local right a way and get wireless running before anything else? |
|
Back to top |
|
|
notHerbert Advocate
Joined: 11 Mar 2008 Posts: 2228 Location: 45N 73W
|
Posted: Thu Oct 09, 2008 4:43 am Post subject: |
|
|
Plz post output if iwconfig |
|
Back to top |
|
|
lelik Tux's lil' helper
Joined: 26 May 2005 Posts: 81 Location: Treasure Island
|
Posted: Thu Oct 09, 2008 12:13 pm Post subject: |
|
|
gives
Code: | lo no wireless extensions.
eth1 no wireless extensions.
sit0 no wireless extensions.
eth0 no wireless extensions.
eth2 IEEE 802.11b/g ESSID:"<removed>" Nickname:"Broadcom 4306"
Mode:Managed Frequency=2.442 GHz Access Point: <removed>
Bit Rate=24 Mb/s Tx-Power=19 dBm
RTS thr:off Fragment thr:off
Encryption key:<removed> Security mode:open
Link Quality=68/100 Signal level=-51 dBm Noise level=-69 dBm
Rx invalid nwid:0 Rx invalid crypt:110 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0 |
|
|
Back to top |
|
|
d2_racing Bodhisattva
Joined: 25 Apr 2005 Posts: 13047 Location: Ste-Foy,Canada
|
Posted: Thu Oct 09, 2008 4:36 pm Post subject: |
|
|
Can you post this :
Maybe you can do somehting with netplug or ifplugd. |
|
Back to top |
|
|
lelik Tux's lil' helper
Joined: 26 May 2005 Posts: 81 Location: Treasure Island
|
Posted: Sat Oct 11, 2008 3:49 pm Post subject: |
|
|
gives
Code: | 00:00.0 Host bridge: ATI Technologies Inc RS480 Host Bridge
00:01.0 PCI bridge: ATI Technologies Inc RS480 PCI Bridge
00:04.0 PCI bridge: ATI Technologies Inc RS480 PCI Bridge
00:13.0 USB Controller: ATI Technologies Inc IXP SB400 USB Host Controller
00:13.1 USB Controller: ATI Technologies Inc IXP SB400 USB Host Controller
00:13.2 USB Controller: ATI Technologies Inc IXP SB400 USB2 Host Controller
00:14.0 SMBus: ATI Technologies Inc IXP SB400 SMBus Controller (rev 10)
00:14.1 IDE interface: ATI Technologies Inc Standard Dual Channel PCI IDE Controller
00:14.3 ISA bridge: ATI Technologies Inc IXP SB400 PCI-ISA Bridge
00:14.4 PCI bridge: ATI Technologies Inc IXP SB400 PCI-PCI Bridge
00:14.5 Multimedia audio controller: ATI Technologies Inc IXP SB400 AC'97 Audio Controller (rev 01)
00:14.6 Modem: ATI Technologies Inc SB400 AC'97 Modem Controller (rev 01)
00:18.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration
00:18.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map
00:18.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller
00:18.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control
01:05.0 VGA compatible controller: ATI Technologies Inc Radeon XPRESS 200M 5955 (PCIE)
03:00.0 FireWire (IEEE 1394): Texas Instruments TSB43AB22/A IEEE-1394a-2000 Controller (PHY/Link)
03:02.0 Network controller: Broadcom Corporation BCM4306 802.11b/g Wireless LAN Controller (rev 03)
03:04.0 CardBus bridge: Texas Instruments PCIxx21/x515 Cardbus Controller
03:04.3 Mass storage controller: Texas Instruments PCIxx21 Integrated FlashMedia Controller
03:04.4 SD Host controller: Texas Instruments PCI6411/6421/6611/6621/7411/7421/7611/7621 Secure Digital Controller
03:06.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)
|
/etc/conf.d/net
Code: | config_eth0=("dhcp")
preup() {
if [[ ${IFACE} == "eth2" ]]; then
if ifplugstatus | grep -q 'eth0: link beat detected'; then
ewarn "Wired connection on eth0 detected, aborting configuration on ${IFACE}"
return 1
fi
fi
}
postup () {
if [[ ${IFACE} == "eth2" ]]; then
iwconfig eth2 txpower on
fi
} |
/etc/ifplugd/ifplugd.action
Code: | if grep -q initng /proc/1/cmdline
then
EXEC="/sbin/ngc"
INITNG="yes"
else
EXEC="/etc/init.d/net.$1"
INITNG="no"
fi
case "$2" in
up)
if [ "${INITNG}" = "yes" ]
then
ARGS="-u net/$1"
else
/etc/init.d/net.eth2 --quiet stop
modprobe -r bmc43xx
ARGS="--quiet start"
fi
;;
down)
if [ "${INITNG}" = "yes" ]
then
ARGS="-d net/$1"
else
ARGS="--quiet stop"
modprobe bmc43xx
/etc/init.d/net.eth2 --quiet start
fi
;;
*)
echo "$0: wrong arguments" >&2
echo "Call with <interface> <up|down>" >&2
exit 1
;;
esac
export IN_BACKGROUND=true
if [ -x "${EXEC}" ]
then
${EXEC} ${ARGS}
exit 0
else
logger -t ifplugd.action "Error: Couldn't configure $1, no ${EXEC} !"
exit 1
fi |
/etc/conf.d/local.start
Code: | /etc/init.d/wirelessstart |
/etc/init.d/wirelessstart.sh
Code: | ifconfig eth2 down
ifconfig eth2 up
wpa_supplicant -Dwext -ieth2 -c/etc/wpa_supplicant/wpa_supplicant.conf -B
dhcpcd eth2 |
|
|
Back to top |
|
|
brackenhill_mob n00b
Joined: 17 Jul 2002 Posts: 62 Location: Berkhamsted, Herts, UK
|
Posted: Thu Oct 16, 2008 7:08 am Post subject: |
|
|
I had the exact same issue.
My hack was to remove ntpdate from the auto start procedure (using rc-update del ntpdate) and append it to the end of my script called from /etc/conf.d/local.start.
The trick for me was to insert a "sleep 30" before the call to ntpdate to allow enough time for wpa_supplicant to do its stuff.
BTW my solution was a little different to yours. I created a symlink from /etc/init.d/net.lo to /etc/init.d/net.wlan0 and edited /etc/conf.d/net appropriately (as I'm sure you have too ). My local.start script just sleeps and calls ntp-client (in my case). The advantage of this is that all the network related daemons (dhcpd, sshd etc) get delayed automatically until wpa_supplicant has associated with the router. Quite why the startup script for ntpXXX isn't is intelligent as the other network daemon scripts is another question ...
HTH |
|
Back to top |
|
|
lelik Tux's lil' helper
Joined: 26 May 2005 Posts: 81 Location: Treasure Island
|
Posted: Sat Oct 18, 2008 11:23 pm Post subject: |
|
|
I moved everything to /etc/conf.d/net, but I cannot make it work the way I wanted.
My new /etc/conf.d/net:
Code: | modules_eth0=( "ifplugd" )
config_eth0=( "dhcp" )
dhcpcd_eth0="-t 5"
modules_eth2=( "wpa_supplicant" )
config_eth2=( "dhcp" )
dhcpcd_eth2="-t 60"
wpa_supplicant_eth2="-Dwext -c /etc/wpa_supplicant/wpa_supplicant.conf"
wpa_timeout_eth2=60
preup() {
if [[ ${IFACE} == "eth2" ]]; then
if ifplugstatus | grep -q 'eth0: link beat detected'; then
ewarn "Wired connection on eth0 detected, aborting configu$
return 1
fi
fi
}
postup () {
if [[ ${IFACE} == "eth2" ]]; then
iwconfig eth2 txpower on
fi
} |
Both network interfaces are symlinked to net.lo
Code: | ls -l /etc/init.d/net.* |
Code: | lrwxrwxrwx 1 root root 6 Aug 3 19:29 /etc/init.d/net.eth0 -> net.lo
lrwxrwxrwx 1 root root 6 Jun 24 2007 /etc/init.d/net.eth2 -> net.lo
-rwxr-xr-x 1 root root 30696 Aug 3 19:29 /etc/init.d/net.lo |
It drives me crazy.
net.eth0 and net.eth2 should I piut them to default or boot level? Neither?
net.lo is already on boot level.
Could you please post the corresponding files from your setup?
What do you use ifplugd or netplug?
Thanks mate. |
|
Back to top |
|
|
brackenhill_mob n00b
Joined: 17 Jul 2002 Posts: 62 Location: Berkhamsted, Herts, UK
|
Posted: Mon Oct 20, 2008 3:31 pm Post subject: |
|
|
net.eth0 and net.eth2 should be in the normal startup level not boot
My /etc/conf/local.start script looks like this
Code: |
GREP_CMD="grep 'inet addr:169.254.'"
/sbin/ifconfig | grep "$GREP_CMD" > /tmp/inetaddr
if [ -s /tmp/inetaddr ]; then
echo "Sleeping for 60 seconds to let WiFi Connect"
sleep 60
fi
rm /tmp/inetaddr
/etc/init.d/ntp-client start
|
I only want my wifi to start if there is no cabled connection on eth0. This script checks the IP address on eth0 and if it isn't set to a valid address, pauses for 60 seconds to allow the wifi router to associate. I have a slider switch on my HP laptop to activate the wifi card on and off. I leave it off unless I need to use wifi; the standard net.eth2 script knows if it is off so doesn't try to associate.
HTH |
|
Back to top |
|
|
lelik Tux's lil' helper
Joined: 26 May 2005 Posts: 81 Location: Treasure Island
|
Posted: Sun Oct 26, 2008 1:55 pm Post subject: |
|
|
I am trying to avoid a 169.254.x.x ip address as all network services like ntp or samba will start on eth0 instead of eth2 (wireless) .
I want my eth0 down when cable is plugged. Not up with a bogus 169.254.x.x, but actually down.
eth2 (wireless) should be up only if eth0 is down.
As soon as I plug the cable eth0 should be up, and eth2 should be down.
Unplug, eth0 down again, and eth2 up.
Look at my /etc/ifplugd/ifplugd.action a few posts up how I am trying to manage it.
But so far no cigars |
|
Back to top |
|
|
|