Author Topic: Establishing Wlan Connection by Command Line  (Read 585 times)

Holger Schuett

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 45
    • View Profile
Establishing Wlan Connection by Command Line
« on: June 14, 2017, 09:29:33 pm »
Hi there,
has anyone ever tried to establish a connection to a wireless network without using Wlanmonitor Wlanstat.exe.
I have succeeded partly but there are still questions left. I would need help/information concerning the command line tools included in genmac and the tools included with Paul Smedleys builds of the wpa_supplicant.exe

Cheers
Holger



Valery Sedletski

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 8
  • Posts: 59
    • View Profile
Re: Establishing Wlan Connection by Command Line
« Reply #1 on: June 16, 2017, 02:20:18 pm »
What is the problem? You just create a config for wpa_supplicant.exe, start it, and additionally start the DHCP client (if needed)

Andi B.

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 12
  • Posts: 312
    • View Profile
Re: Establishing Wlan Connection by Command Line
« Reply #2 on: June 16, 2017, 04:34:48 pm »
I've played a bit with wpa_gui.exe included with wpa_supplicant at the time I compiled the supplicant. It works outside Wlanstat/xwlan. AFAIR the genmac bin files understand the --verbose option. But that didn't help me much at that time I played with it.

Holger Schuett

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 45
    • View Profile
Re: Establishing Wlan Connection by Command Line
« Reply #3 on: June 16, 2017, 09:01:11 pm »
Valery and Andi,
thank you for your replys.
Valery, concerning the wpa_supplicant: Yes, I managed to create a config file for the supplicant and starting the supplicant with (in my case) wpa_supplicant.exe -B -i lan0 -c wpa_supplicant.conf did establish the connection to my wlan at home.

What makes me curious: As I had no documetation for os2/arcaos I started looking for information and found detailed instructions for linux systems. So my first steps  were to proceed according to these informations. For example: According to the information one should/could use the wpa_cli program/exe (which is included in the Paul Smedley builds of the WPA_Supplicant)
So to start with I wrote a config file for wpa_supplicant with the lines:

ctrl_interface=wpa_supplicant
update_config=1
and saved this as wpa_supplicant.conf

The I started the wpa_cli.exe with scan_results. This showed the networks available.
The next step was to run wpa_cli.exe with add_network. This returned a result as 0, meaning the the network 0 had been "created".
I then proceeded with wpa_cli set network 0 "ssid" which would be the ssid of my wlan at home, this returned: FAIL
As far as I understood the documentation this should have worked and been written into the wpa_supplicant.conf. Looking at the .conf file there was no entry, so it did fail.
By chance I then started the wpa_gui.exe Andi mentioned (included in the Paul Smedley builds too) and there in the networ field was an entry 0 without the ssid name.
So i took chances and entered the ssid name, authentication, encryption etc in the wpa_gui.exe and then went for "save configuration" and yes, the network was saved as entry in the wpa_supplicant.conf.

What I would like to know:
First of all is there a possiblity to start wpa_supplicant in the background when booting (config.sys??)
-What for example are the differances between the wpa_cli.exe in linux and os2 concerning the available parameters for running.
-Or why are the entries in the wpa_supplicant.conf saved when using the gui but not when running the wpa-cli.exe with the parameters I mentioned before

To Andi:
I really appreciate the wlan monitor /wlan stat.exe. My problem is that on my X61 neither really works without problems (I had an R52 Thinkpad before where everything worked fine).
After installing f.e. ArcaOS I was able to establish connection to my wlan with the wlanstat.exe / widget but the connection frequently dropped and I had to restart/reenable the connection again. And sometimes the connection was not established before trying 3 or 4 times. Actually I do believe there is a problem with the dhcp client shipped with arcaOs (no offense, this is my believe and as mentioned this is my x61 which might be causing problems).
I then switched back to the genmac which was included in ecs2.2 and wlanmonitor 3.10.
This worked much better ( I believe this involves the old os2 dhcp client). The problem here was that when starting with either the widget or the .exe my workplace.shell did not work any longer.CAD and killing the process (wlan)helps and mostly a second try is successful, but this was the moment I started wondering and playing around.

Holger


Andi B.

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 12
  • Posts: 312
    • View Profile
Re: Establishing Wlan Connection by Command Line
« Reply #4 on: June 17, 2017, 02:59:21 pm »
Quote
Actually I do believe there is a problem with the dhcp client shipped with arcaOs (no offense, this is my believe and as mentioned this is my x61 which might be causing problems).
I then switched back to the genmac which was included in ecs2.2 and wlanmonitor 3.10.
This worked much better ( I believe this involves the old os2 dhcp client).
Do you have setup DHCP for your wired NIC too? This may be a problem. Or do you use static IP address for your wired NIC? If you think DHCP is the problem you do not need to downgrade genmac. Does xwlan v3.10 work with the ArcaOS installed genmac?

Quote
The problem here was that when starting with either the widget or the .exe my workplace.shell did not work any longer.CAD and killing the process (wlan)helps and mostly a second try is successful
I know there are a lot of things which can go wrong in xwlan v3.10 and end up in crashes. I fixed many of them in v3.12 :), probably not all of course.

The ISC dhclient (included with ArcaOS and used by xwlan/wlanstat > v3.11) only configures the wireless interface. But the original IBM dhcp client confuses interfaces and can not be set up to only work with one interface (the wired one) reliable. That's the reason why xwlan/wlanstat kills IBM dhcp client when firing up the wireless connection or reconfigures it. But if IBM dhcp client is re-enabled then it may mess up IP configurations for wired and wireless connections again. Both can't work together reliable. If you need DHCP for the wired and the wireless interface set up dhclient for both. Unfortunately this is not supported by the ArcaOS installer. So simplest advice here is - don't use DHCP for the wired interface when you need it for wireless.

Let me know if this helps to find out if DHCP (dhclient) is really your problem with your X61 installation.

Btw. dhclient fires up a minimized window which sometimes is useful to look at. And the xwlan3.12 included ifc2.cmd helps a lot with IP configuration issues. Try it out.

Holger Schuett

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 45
    • View Profile
Re: Establishing Wlan Connection by Command Line
« Reply #5 on: June 18, 2017, 10:32:45 am »
Hi Andi,

Quote
Do you have setup DHCP for your wired NIC too? This may be a problem. Or do you use static IP address for your wired NIC? If you think DHCP is the problem you do not need to downgrade genmac. Does xwlan v3.10 work with the ArcaOS installed genmac?

I already posted yesterday, but something must have gone wrong?
OK: I did not set up DHCP for the wired NIC. When I installed ArcaOS only the wireless was recognized and configured and I did not try afterwards.

What I did yesterday: I uninstalled the genmac I had been using the last few days and reinstalled genmac using the package shipping with ArcaOS (just for the records, only the wireless is supported).
Then I tried xwlan 3.10 together with the ArcaOS genmac, and no, it did not work.
So I removed 3.10 and installed the version coming with ArcaOS. I preferred to install the exe and not the widget.
Now the behavior is actually the same as it was after the original install: It does work, but f.e. it might take 3 attempts to establish a connection to my wireless. ( I do have a profile, the standard one I have always used with genmac/xwlan)

When starting the exe the wpa_supplicant often shows the following line:
CTRL-EVENT-DISCONNECTED bssid=30:00:77:5c:06:00 reason=3 locally_generated=1
No network configuration found for the current AP

Another observation: With the original install the widget was installed. Starting the widget I could occasionally see that the dhclient was started (one could see the window in xcenter ) and then another window would pop up (dhclient.conf I believe).
This would read something like : cant create dhclient.leases/dhclient.pid
There is a ticket in the Mantis Bugtracker at Arca Noae: https://mantis.arcanoae.com/view.php?id=1105
(As this had already bee opened I did not open one myself, but it is the same Nic/Driver that I use : 4965)
Ok, so these windows are no longer showing when I start the exe now.

And one final question:
In your first post you say that you compiled the wpa_supplicant, or did I misunderstand you? If so, what are the differences between the wpa_supplicant compared to the one included with xwlan 3.10
As mentioned I had set up a commandline and a wpa_supplicant.conf which would establish a network connection. Trying this now fails with the wpa_supplicant inlcuded in the ArcaOS package?

Once again thank you for your replys and your help.

Holger


Andi B.

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 12
  • Posts: 312
    • View Profile
Re: Establishing Wlan Connection by Command Line
« Reply #6 on: June 18, 2017, 04:14:16 pm »
Quote
Another observation: With the original install the widget was installed. Starting the widget I could occasionally see that the dhclient was started (one could see the window in xcenter ) and then another window would pop up (dhclient.conf I believe).
Regardless of widget or the wlanstat.exe dhclient.exe is fired up when DHCP is enabled in properties AND profile (guess it needs both setting). AFAIR dhclient.exe and dhconf.cmd window are shown only when logging to file is not enabled. Otherwise they are started detached in background IIRC.

Quote
...you say that you compiled the wpa_supplicant, or did I misunderstand you? If so, what are the differences between the wpa_supplicant compared to the one included with xwlan 3.10...
I'm not sure if wpa_supplicant is delivered with v3.10. At that time probably wpa_supplicant v1.x or 2.0 was current. With xwlan v3.12 I packed together the latest (at that time) wpa_supplicant v2.2. From the wpa_supplicant readme here - http://trac.netlabs.org/ports/browser/wpa_supplicant/trunk/README.OS2
Code: [Select]
wpa_supplicant package for xwlan/wlanstat
2 ------------------------------------------------------------------------------
3 Author:          Jouni Malinen and contributors
4                  Ported to OS/2 - eCS by Paul Smedley & Andreas Buchinger
5 Last update:     20140911
6 Current status:  v2.2 (eCS-v1)
7 Home page:       http://trac.netlabs.org/ports/browser/wpa_supplicant
8
9 wpa_supplicant was ported to OS/2 - eCS for use with xwlan/wlanstat. First port
10 was made by Willibald Meyer. Maybe together with Christian Langanke the original
11 author of xwlan. Later on Paul Smedley distributed different versions. Finally
12 Andreas Buchinger set up the svn repository at netlabs.org with Pauls v2.2
13 version and packed this build together.
14
15 Prerequisite:
16 -------------
17 - OS/2 or eCS with 32-bit TCP/IP stack. I've tested mainly with eCS2.1DE
18 - libc065.dll (yum install libc)
19 - crypto10.dll, ssl10.dll (yum install openssl)
20
21
22 Optional components:
23 --------------------
24
25
26 Installation:
27 -------------
28
29
30 History:
31 --------
32 20140910 v2.2 (eCS-v1)
33 - first build from the official OS/2 - eCS repository at
34   http://trac.netlabs.org/ports/browser/wpa_supplicant
35 - minor changes to build cleanly with rpm installed gcc
36 - added bldlevel information and version postfix (eCS-v1)
37 - added README.OS2 with build instructions
...

If you start wpa_supplicant from cli and need DHCP you have to start dhclient maually too. 'dhclient lan1' (use your wireless interface number) is sufficient. Of course you can start the old IBM client instead if you like.



Holger Schuett

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 45
    • View Profile
Re: Establishing Wlan Connection by Command Line
« Reply #7 on: June 20, 2017, 07:00:41 pm »
Hi Andi,
sorry for the delayed response, I was quite busy the last few days.
Quote
Regardless of widget or the wlanstat.exe dhclient.exe is fired up when DHCP is enabled in properties AND profile (guess it needs both setting).
Both are enabled.
Quote
AFAIR dhclient.exe and dhconf.cmd window are shown only when logging to file is not enabled. Otherwise they are started detached in background IIRC.
.
You are right and this was only mentioned as observation. (After reinstalling the genmac /wlanmonitor shipping with Arcaos I had enabled the logging.)
Nonetheless, I still believe there are problems on this x61 with the dhclient. Sometimes the connections is established shortly after having started wlanstat.exe, the dhclent window pops up in xcenter ( I disabled logging again), on other occasions the wlanstat.exe starts, but nothing appears to happen. The wlanstatexe closes again without an connections established. Taking the dhclient window as proof: The window does not pop up and the wpa_supplicant show the line mentioned:
lan0: CTRL-EVENT-DISCONNECTED bssid=30:00:77:5c:06:00 reason=3 locally_generated=1

Anyway I will keep on trying to work things out

Thank you once again.

Holger