You are not logged in.

#1 2008-02-22 19:26:49

IMG
Member
From: Greece
Registered: 2008-02-22
Posts: 21

wifi configuration (netcfg2/rc.conf) fails to "auto work on boot"

Hey :- ) ,


I have been trying to figure out how to configure my laptop to get associated AND receive its static ip  "on boot". In short i have tried various configurations and different methods, but seems like with some of them i manage to get my wifi card an ip but let in the "not-associated-land" , while with others i get it associated with my wireless router but the interface cant get brought up, so i cant ping anything.Lets get the details here:

First of all, laptop's wifi card is the Intel Wireless Pro 4965 one, and the module used is the corresponding iwl4965.

Under simple manual editing of rc.conf the way described in the wiki wlan0 interface succesfully gets configured with the desired static IP  plus the interface gets brought up succesfully on boot.Unfortunately though it is let in the "Cell: not associated" status.
Here you can see ifconfig wlan0 and iwconfig wlan0 after booting is completed:

ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr 00:1D:E0:5A:4B:63
          inet addr:10.0.0.12  Bcast:10.0.0.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

iwconfig wlan0
wlan0     IEEE 802.11g  ESSID:"<myessid>"
          Mode:Managed  Frequency:2.412 GHz  Access Point: Not-Associated
          Tx-Power=27 dBm
          Retry min limit:7   RTS thr:off   Fragment thr=2346 B
          Link Quality:0  Signal level:0  Noise level:0
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

Simply issuing :

iwconfig wlan0 mode managed essid <myessid>

gets everything working , but i need zero configuration connection on boot.So no joy.

and ifconfig wlan0 , iwconfig wlan0 looks like

ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr 00:1D:E0:5A:4B:63
          inet addr:10.0.0.12  Bcast:10.0.0.255  Mask:255.255.255.0
          inet6 addr: fe80::21d:e0ff:fe5a:4b63/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:15 errors:0 dropped:0 overruns:0 frame:0
          TX packets:19 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1609 (1.5 Kb)  TX bytes:1897 (1.8 Kb)

iwconfig wlan0
wlan0     IEEE 802.11g  ESSID:"<myessid>"
          Mode:Managed  Frequency:2.412 GHz  Access Point: 00:14:7F:84:8D:67
          Bit Rate=54 Mb/s   Tx-Power=27 dBm
          Retry min limit:7   RTS thr:off   Fragment thr=2346 B
          Encryption key:off
          Link Quality=100/100  Signal level=-44 dBm  Noise level=-93 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

Under netcfg2 , using an edited version of the "complete.example" my wifi card gets associated with my AP on boot , but unfortunately it doesnt get brought up (according to man ifconfig , this happens when it fails to get an IP). In this case issuing :

ifconfig wlan0 up
iwconfig wlan0 essid <myessid>

gets everything working again .But still its not 100% automated.

Here i am posting my files.Some parts of it are commented/disabled to swap among netcfg2 configuration and manual rc.conf edited configuration.

here is my /etc/rc.conf network part  file

HOSTNAME="robonoobs"
#
#
lo="lo 127.0.0.1"
#WLAN_INTERFACE=(wlan0)
#eth0="eth0 10.0.0.12 netmask 255.255.255.0 broadcast 10.0.0.255"
#wlan0="wlan0 10.0.0.12 netmask 255.255.255.0 broadcast 10.0.0.255"
#wlan_wlan0="wlan0 mode managed  essid <myessid>"
#following /bin/sleep 5 is there just to get a chance to see messages without searching logs during #testing period
#echo "SLEEP 5"
#/bin/sleep 5
#WIFI_WAIT = 10
INTERFACES=(lo !eth0 !wlan0)
#
#
gateway="default gw 10.0.0.1"
ROUTES=(gateway)
#
# Network profiles are found in /etc/network-profiles
#
NET_PROFILES=(!wifi_init)
#complete found at /etc/network.d/
NETWORKS=(complete !wifi_init)
# -----------------------------------------------------------------------
# DAEMONS
# --------------------------------------------------------------------
DAEMONS=(syslog-ng netfs !crond alsa !fam hal network net-profiles kdm)

here comes my netcfg2 profile named "complete"

CONNECTION="wireless"
DESCRIPTION="Very verbose complete wireless example"

INTERFACE=wlan0
HOSTNAME=robonoobs


# Interface Settings (use IFOPTS="dhcp" for DHCP)
IP="static"
IFOPTS="inet 10.0.0.12 netmask 255.255.255.0 broadcast 10.0.0.255"
GATEWAY=10.0.0.1


# DHCP Example
#IFOPTS=dhcp
#DHCP_TIMEOUT=20 # Default is 10.
#DHCP_OPTIONS="" # Extra arguments for dhcpcd

# DNS Settings (optional)
DOMAIN=robonoobs.domain.org
DNS1=10.0.0.1
DNS2=
SEARCH=

# Standard Wireless Settings
ESSID=<myessid>
SECURITY=none # One of wep, wpa, wpa-config, none
#KEY="SomePasskey"

# Scans to see if network is available before connecting (reccomended)
SCAN="NO"
#tried with this one set to "YES" with the same result,  gets associated but is not brought up

# Time to wait to connect to a network. Default 15.
TIMEOUT=15

# Pass *custom* options to iwconfig. Usually not needed (optional)
IWOPTS="wlan0 mode managed essid $ESSID"

# Any extra arguments for wpa_supplicant
WPA_OPTS=

# For SECURITY='wpa-config' only - filename of a wpa-supplicant config
WPA_CONF=

# Commands to run at various stages of configuration
PRE_UP= 
POST_UP= 
PRE_DOWN=
POST_DOWN="some command"

here follows "iwconfig wlan0" right after booting is completed, which shows wlan0 associated with the AP in question:

wlan0     IEEE 802.11g  ESSID:"<myessid>"
          Mode:Managed  Frequency:2.412 GHz  Access Point: 00:14:7F:84:8D:67
          Bit Rate=54 Mb/s   Tx-Power=27 dBm
          Retry min limit:7   RTS thr:off   Fragment thr=2346 B
          Encryption key:off
          Link Quality=88/100  Signal level=-45 dBm  Noise level=-127 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

here is ifconfig wlan0 right after booting up:

wlan0     Link encap:Ethernet  HWaddr 00:1D:E0:5A:4B:63
          inet addr:10.0.0.12  Bcast:10.0.0.255  Mask:255.255.255.0
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

At this part i am only able to ping 10.0.0.12 .
Here ere are both of them after issuing ifconfig wlan0 up and iwconfig wlan0  essid <myessid>

ifconfig wlan0

wlan0     Link encap:Ethernet  HWaddr 00:1D:E0:5A:4B:63
          inet addr:10.0.0.12  Bcast:10.0.0.255  Mask:255.255.255.0
          inet6 addr: fe80::21d:e0ff:fe5a:4b63/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:24 errors:0 dropped:0 overruns:0 frame:0
          TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2072 (2.0 Kb)  TX bytes:2160 (2.1 Kb)

iwconfig wlan0 essid <myessid>

wlan0     IEEE 802.11g  ESSID:"<myessid>"
          Mode:Managed  Frequency:2.412 GHz  Access Point: 00:14:7F:84:8D:67
          Bit Rate=54 Mb/s   Tx-Power=27 dBm
          Retry min limit:7   RTS thr:off   Fragment thr=2346 B
          Encryption key:off
          Link Quality=100/100  Signal level=-40 dBm  Noise level=-92 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

At this point i can ping all my local network devices , such as my gateway at 10.0.0.1. but no internet "connect: Network is unreachable" after issuing

/etc/rc.d/network restart

everything is up and running and i have access to the net.This seems quite a puzzle to me, since restarting network should reset everything and i should be able to ping only 10.0.0.12 , no?


Thats it,  unfortunately i didnt manage to get a workaround on that alone ...propably i am overlooking something obvious badly.

Any suggestions on how to fix this, or any other way on geting wifi completely working on boot without touching my laptop will be greatly appreciated.

IMG

Offline

#2 2008-02-23 00:41:20

IMG
Member
From: Greece
Registered: 2008-02-22
Posts: 21

Re: wifi configuration (netcfg2/rc.conf) fails to "auto work on boot"

Well , since this issue got seriously on my nervers and took me a day trying things out with no luck, i studied a bit of shell programming and wrote a script to configure my net on boot, copied it with the correct permissions in /etc/rc.d/    , added it in my daemons at rc.conf, and there you go! Net on boot finally : -).

#!/bin/sh

echo "sleeping to ensure network is up"
/bin/sleep 2

until [ "$(ifconfig wlan0 | grep -c "UP")" != "0" ]
do
    echo "waiting for wlan0 interface to get UP"
    /bin/sleep 2
done

        echo "checking if wlan0 is associated "
        
while [ "$(iwconfig wlan0 | grep -c "Access Point: Not-Associated")" != "0" ]  
 do
     $(iwconfig wlan0 essid Virus_Home)
     echo "sleeping for 20 seconds to give hardware some time to associate "
     /bin/sleep 20
 done
 
exit 0

However i dont concider my solution  elegant , so if anyone can figure out why net doesnt get configured correctly on boot without my script i would love to know as well.

enjoy,
IMG

Offline

Board footer

Powered by FluxBB