A few quick questions

Live forum: http://rt2x00.serialmonkey.com/viewtopic.php?t=5163

executivul

15-01-2009 15:27:13

First I want to appologise to moderators for the double thread but seeing that nobody answered on the "script help" topic I'm trying my luck with a few quick questions, which in some part overlaps with the scipt, please do not delete. Thank you.

1. What is the normal/best way of configuring the rt73 card at boot (at boot, after modprobe rt73usb, the interface is DOWN)
a. iwconfig wlan0 essid "myessid"; ifconfig wlan0 up (first iwconfig then bring the interface up)
b. ifconfig wlan0 up; iwconfig wlan0 essid "myessid" (first bring the interface up)

2. If I want to scan for the network first I must bring the interface up (ifconfig wlan0 up) after that what is the normal/best way to configure it
a. iwconfig wlan0 essid "myessid" (with the interface still up)
b. ifconfig wlan0 down; iwconfig wlan0 essid "myessid"; ifconfig wlan0 up

3. If I for some reason lose physical connectivity (go to far from ap) while connected (interface up, iwconfig shows connected), how do I reconnect to the network
a. do nothing, the driver will reconnect automaticlly
b. just iwconfig wlan0 essid "myessid", keep the interface up and dhcpcd running
c. ifconfig wlan0 down; killall dhcpcd; rm -f dhcpcd_files; iwconfig wlan0 essid "myessid"; ifconfig wlan0 up; dhcpcd -t 30 wlan0

IvD

15-01-2009 19:36:52

First I want to appologise to moderators for the double thread but seeing that nobody answered on the "script help" topic I'm trying my luck with a few quick questions, which in some part overlaps with the scipt, please do not delete. Thank you.
[/quote1qrfz0l7]

Don't worry. )
But just to be clear, your other posts was way to vague for me to see what you actually wanted. It is far more easier for me to answer some clear questions like you do in this topic, than investigate a complete script trying to find out what exactly you need and what might be done better.


1. What is the normal/best way of configuring the rt73 card at boot (at boot, after modprobe rt73usb, the interface is DOWN)
a. iwconfig wlan0 essid "myessid"; ifconfig wlan0 up (first iwconfig then bring the interface up)
b. ifconfig wlan0 up; iwconfig wlan0 essid "myessid" (first bring the interface up)
[/quote1qrfz0l7]

Doesn't matter, both are fine.
2 notes about iwconfig
- Setting the 'ap' (bssid) value should only be done while the interface is up. (it is possible to set it while interface is down though).
- Setting the 'mode' (managed, infra, monitor...) can only be done while the interface is down


2. If I want to scan for the network first I must bring the interface up (ifconfig wlan0 up) after that what is the normal/best way to configure it
a. iwconfig wlan0 essid "myessid" (with the interface still up)
b. ifconfig wlan0 down; iwconfig wlan0 essid "myessid"; ifconfig wlan0 up
[/quote1qrfz0l7]

The easy way. ;) Just keep the interface up when you want to switch essid.
However and this is _very_ important an association will not start until you set 'iwconfig wlan0 ap ...' for each association attempt you must set the ap.


3. If I for some reason lose physical connectivity (go to far from ap) while connected (interface up, iwconfig shows connected), how do I reconnect to the network
a. do nothing, the driver will reconnect automaticlly
b. just iwconfig wlan0 essid "myessid", keep the interface up and dhcpcd running
c. ifconfig wlan0 down; killall dhcpcd; rm -f dhcpcd_files; iwconfig wlan0 essid "myessid"; ifconfig wlan0 up; dhcpcd -t 30 wlan0[/quote1qrfz0l7]

The driver will do nothing automatically, all actions must come from userspace. Basically all three options above are wrong, to trigger a reassociation you must call 'iwconfig wlan0 ap ...' there is no need to bring down the interface.

Why are you using dhcpd? If you want a fast connect/reconnect in such quick times that wpa_supplicant isn't usable for you, you might want to switch to static IPs to reduce the required time for DHCP requests.

executivul

15-01-2009 21:44:51

thanks for replying )
I got the idea so you can bassically delete the other topic )

Now back to the questions I still have, my linux runs on several machines (computers in vehicles), don't know how many, I mean I know but it's not the same number forever, not all connected at the same time, so using a /16 net would not be a good idea, for the moment I have 80 vehicles but plan to extend, maybe more then 250... that's why I'd rather use dhcp than keep trck of ips... (argument 1).
The same linux computers use other free networks (hot-spots) which use dhcp.(arg 2)

So I thought it's simpler to stick to dhcp )

My network does not use protection of any kind, (WDS limit bassicaly) but I've configured my server not to allow ip forwarding, so people should not use it as a free access point ), the server only accepts SSH with DSA keys, pretty safe as far as I've read.

About what you said, I allways run my iwconfig like "iwconfig wlan0 essid "mynet" ap any", but know I understand why I have to use the "ap any" part. I never set the mode, since is always managed.

Questions
1. Now speaking about DHCP, do I have to kill the dhcpcd every time I reconnect???
2. The simple algorithm of connecting would be
[code2n9oha81] 1-load modules, bring the interface up.
2-scan for the network. repet while not available.
3-attempt connect by "iwconfig essid ... ap any"
4-?restart? dhcpcd
5-test connection[/code2n9oha81] Is it correct?
3. If I issue once the "iwconfig essid ..."(boot script for example) do I have to include it again every time I attempt an association?
3. If I'm already connected (associated) and I issue the "iwconfig ap any" command what is the result?

Thanks again for your interest.

IvD

15-01-2009 21:59:11


About what you said, I allways run my iwconfig like "iwconfig wlan0 essid "mynet" ap any", but know I understand why I have to use the "ap any" part. I never set the mode, since is always managed.
[/quote16argew8]

No you shouldn't use 'ap any' you should use the BSSID value from the beacon. The 'ap' value will trigger the association with the AP you passed as argument so the value you pass to it is important.


Questions
1. Now speaking about DHCP, do I have to kill the dhcpcd every time I reconnect???
[/quote16argew8]

I don't think so, but it might force DHCP to send out a new dhcp request faster that way. You need to check the dhcpd docs for that.


2. The simple algorithm of connecting would be
[code16argew8] 1-load modules, bring the interface up.
2-scan for the network. repet while not available.
3-attempt connect by "iwconfig essid ... ap any"
4-?restart? dhcpcd
5-test connection[/code16argew8] Is it correct?
[/quote16argew8]

Except for the 'ap any' part, it looks fine. Resetting the essid can be skipped unless it has changed.


3. If I issue once the "iwconfig essid ..."(boot script for example) do I have to include it again every time I attempt an association?
[/quote16argew8]

Setting the essid only has to happen once, so during boot is sufficient.


3. If I'm already connected (associated) and I issue the "iwconfig ap any" command what is the result?
[/quote16argew8]

Setting the 'ap' while associated will probably trigger a reassociation

executivul

15-01-2009 22:11:10

I keep stressing you, sorry for that, but help me understand a few things

1. What the ap anny does??? I use wds so I thought the ap any will associate with the best (strongest) ap from the myessid net.

2. How do I discover the BSSID? from the "iwlist wlan0 scan" output???

IvD

15-01-2009 22:17:56


1. What the ap anny does??? I use wds so I thought the ap any will associate with the best (strongest) ap from the myessid net.
[/quote2p0mz3m7]

No, the driver will not choose the best AP to connect to, that is work done by userspace (this is something why wpa_supplicant is always usefull ;) )

"iwconfig wlan0 ap any" shouldn't do anything in particular, perhaps that for some drivers it does something, but mac80211 based drivers shouldn't do anything (perhaps it triggers a reassociation or disassociation, but it should never try to auto-associate to a random AP from the scan results.).


2. How do I discover the BSSID? from the "iwlist wlan0 scan" output???[/quote2p0mz3m7]


Consider the following scan result

[code2p0mz3m7]
Cell 01 - Address: 00:16:B6:12:5E:5C
ESSID:"Atlantis"
Mode:Master
Channel:6
Frequency:2.437 GHz (Channel 6)
Quality=48/100 Signal level=-68 dBm
Encryption key:on
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 22 Mb/s
6 Mb/s; 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s
36 Mb/s; 48 Mb/s; 54 Mb/s
Extra:tsf=000000c9d7084bea
[/code2p0mz3m7]

The BSSID is the MAC address of the AP, so in this case 0016B6125E5C

executivul

15-01-2009 22:22:41

Thank you very much for your answers.

I will update my script accordingly and hope for the best )

Good Night.