Please support VectorLinux!

Author Topic: inserting delays into rc.local (automating Wireless)  (Read 6323 times)

mick12345678

  • Vectorite
  • ***
  • Posts: 140
inserting delays into rc.local (automating Wireless)
« on: July 28, 2008, 11:24:15 am »
I have succeeded in getting a Netgear WG111T to connect to my WiFi router using WPA, much to my surprise  ;D. (using Standard 5.8, ndiswrapper, Vista drivers).

What works is this :

Ifplugd brings up the wlan0 interface, then

Code: [Select]
iwconfig wlan0 essid "myrouter"
Code: [Select]

Wait for the ssid association to happen, then

Code: [Select]
wpa_supplicant -Dwext -i wlan0 -c/etc/wpa_supplicant.conf
Code: [Select]

Wait a bit, then

Code: [Select]
dhcpcd wlan0
Code: [Select]

I am now ready to put this into rc.local, so as to automate it.

Question is - how do I configure the delays ?
Better question - can I avoid hard-coded delays by getting stage 2 to trigger on completion of stage 1 ?

M0E-lnx

  • Administrator
  • Vectorian
  • *****
  • Posts: 3208
Re: inserting delays into rc.local (automating Wireless)
« Reply #1 on: July 28, 2008, 11:57:58 am »
You can automate just the exact time to wait by concatenating your commands into one line
in your case
Code: [Select]
iwconfig wlan0 essid "yourRouter" && wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf && dhcpcd wlan0 &That will automate the entire thing

mick12345678

  • Vectorite
  • ***
  • Posts: 140
Re: inserting delays into rc.local (automating Wireless)
« Reply #2 on: July 28, 2008, 02:00:42 pm »
thanks - hole in one, by the sound of it  ;D
I will try that.

mick12345678

  • Vectorite
  • ***
  • Posts: 140
Re: inserting delays into rc.local (automating Wireless)
« Reply #3 on: July 30, 2008, 11:18:10 am »
well, everything worked except the dhcp bit - I had to do that manually (which did then work).
It seems running dhcp on completion of the WPA setup is not enough - it needs a definite delay.

So, I'll try static addressing.
I know what I need to add to the "rc.inet<n>" file to do this, but how do I know what value of <n> to use ?
I know its not "inet1", as that is for eth0, which is the LAN port (which works).
"inet2" references "eth1", but my wireless port is "wlan0". Is "wlan0" an alias for "eth1" ?

 
« Last Edit: July 30, 2008, 12:00:42 pm by mick12345678 »

nightshift

  • Member
  • *
  • Posts: 22
Re: inserting delays into rc.local (automating Wireless)
« Reply #4 on: July 30, 2008, 05:19:12 pm »
Hi mick12345678:

    The command you are looking for is "sleep <n>" where <n> it the seconds you want to sleep.

from MOE-lnx
Quote
iwconfig wlan0 essid "yourRouter" && wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf && dhcpcd wlan0 &

I am not sure if sleep lets say 10 seconds will work in MOE-lnx's command but you can try it.
iwconfig wlan0 essid "yourRouter" && wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf && sleep 10 && dhcpcd wlan0 &

nightshift

mick12345678

  • Vectorite
  • ***
  • Posts: 140
Re: inserting delays into rc.local (automating Wireless)
« Reply #5 on: July 31, 2008, 02:30:12 pm »
thanks - I'll try that when I revert back to dhcp.

For now, I have got everything working using static. Here is what I have in rc.local

Code: [Select]
ifconfig wlan0 192.168.1.7 netmask 255.255.255.0
route add default gw 192.168.1.254
iwconfig wlan0 essid "mrstestalot" && wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf  &

« Last Edit: July 31, 2008, 02:32:50 pm by mick12345678 »