View Single Post
Old 24th August 2016
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 1,027
Default

Quote:
Originally Posted by bsd-keith View Post
I'm going to assign NetBSD to the bit bucket,
I'm sorry to hear you had to give up, but there can be limited time to try these things at one time. Unfortunately I was unable to respond at any length until now. Maybe the following along with shep's information can help in the future, or for someone else.

My approach to this problem would be to get wireless working, step-by-step, from the command line first. Only once everything succeeded that way would I possibly try to configure it automatically via the configuration files. This way you can beat on each step repeatedly and in isolation until it works, without trying to build on it. In fact, I haven't ever set up the config files to have the system do things automatically.

So here is a bare bones summary of what little I know. First check the dmesg to make sure the wireless device is configured. I see you've done that. My examples will use rtwn0 which applies on my laptop. All commands are run as root.

Code:
# ifconfig -a
...
rtwn0: flags=0x8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
        ssid ""
        powersave off
        address: 00:de:ad:be:ef:00
        media: IEEE802.11 autoselect
        status: no network
...
Look for Access Points (APs); the interface must be up to scan:

Code:
# ifconfig rtwn0 up
# ifconfig rtwn0 list scan
SSID                              BSSID              CHAN RATE  S:N     INT CAPS
SomeAccessPoint                    00:50:07:e3:84:0    1   54M 172:0    100 EP   RSN WME
...
OPTIONAL: You can get a lot of info about potential peers from wlanctl(8)
Code:
# wlanctl rtwn0
...(tons of output)...
WPA Supplicant: Create suitable configuration files for the APs you will use.

Some sample configuration files:

Code:
OPEN AP
-------
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel

network={
        ssid="Open AP SSID"
        scan_ssid=1
        key_mgmt=NONE
}

WEP AP
------
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel

network={
        ssid="WEP AP SSID"
        scan_ssid=1
        key_mgmt=NONE
        wep_tx_keyidx=0
        wep_key0=1234567890
}

WPA2 AP
-------
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel

network={
        ssid="WPA AP SSID"
        scan_ssid=1
        key_mgmt=WPA-PSK
        psk="passphrase"
        #  ** OR **
        psk=64 hex digits without quotes
}
Run wpa_supplicant:

Code:
# wpa_supplicant -Bd -c /path/to/wpa-supplicant.conf -i rtwn0
Adding "-f file" will send debugging messages (from "-d") to file.

Check if the network is up:

Code:
# ifconfig rtwn0

rtwn0: flags=0x8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        ssid "YourAP" nwkey 65536:"",0xb56f5d0192837465d086b54666dc606f5,"",""
        powersave off
        bssid 23:f7:34:23:de:34 chan 1
        address: 00:de:ad:be:ef:00
        media: IEEE802.11 autoselect (OFDM54 mode 11g)
        status: active
        inet6 fe80::d2df:9aff:fe7e:4461%rtwn0 prefixlen 64 scopeid 0x2
OPTIONAL: You can now check for network activity without even having an IP address. This can confirm that "things are working so far".

Code:
# tcpdump -ni rtwn0

tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on rtwn0, link-type EN10MB (Ethernet), capture size 262144 bytes
19:34:00.263402 ARP, Request who-has 192.168.1.134 (ff:ff:ff:ff:ff:ff) tell 192.168.1.23, length 28
19:34:00.263800 ARP, Request who-has 192.168.1.133 (ff:ff:ff:ff:ff:ff) tell 192.168.1.23, length 28
...
IP configuration: When I first started using wireless, I looked at both dhcpcd and dhclient. I found the latter much easier to understand and have used it exclusively since. It's usually this simple:

Code:
# dhclient -v [-1] rtwn0

Internet Systems Consortium DHCP Client 4.3.3
Copyright 2004-2015 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on BPF/rtwn0/00:de:ad:be:ef:00
Sending on   BPF/rtwn0/00:de:ad:be:ef:00
Sending on   Socket/fallback
DHCPDISCOVER on rtwn0 to 255.255.255.255 port 67 interval 6
DHCPREQUEST on rtwn0 to 255.255.255.255 port 67
DHCPOFFER from 192.168.1.3
DHCPACK from 192.168.1.3
bound to 192.168.1.17 -- renewal in 37764 seconds.
Another ifconfig should now show you have an IP address:

Code:
# ifconfig rtwn0
rtwn0: flags=0x8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        ssid "YourAP" nwkey 65536:"",0xb56f5d0192837465d086b54666dc606f5,"",""
        powersave off
        bssid 23:f7:34:23:de:34 chan 1
        address: 00:de:ad:be:ef:00
        media: IEEE802.11 autoselect (OFDM54 mode 11g)
        status: active
        inet 192.168.1.17 netmask 0xffffff00 broadcast 192.168.1.255
        inet6 fe80::d2df:9aff:fe7e:4461%rtwn0 prefixlen 64 scopeid 0x2
I think your /etc/resolv.conf will be updatted here too. You might also want to check that routing is sane:

Code:
# route -n  show -inet
To shut it all down you can kill dhclient and wpa_supplicant (you type what is in blue):

Code:
# pkill dhclient

# wpa_cli
wpa_cli v2.4
Copyright (c) 2004-2015, Jouni Malinen <j@w1.fi> and contributors

This software may be distributed under the terms of the BSD license.
See README for more details.


Selected interface 'rtwn0'

Interactive mode

> term
19:37:39.515: OK

  19:37:39.517: CTRL-EVENT-DISCONNECTED bssid=23:f7:34:23:de:34 reason=3 locally_generated=1
  19:37:39.517: CTRL-EVENT-TERMINATING
Connection to wpa_supplicant lost - trying to reconnect
> quit
ADDED #1: There is a politer way to terminate dhclient:
Code:
# dhclient -r rtwn0
As I said, I've never put the wireless setup into the start-up configuration files, so might not be the best person to help with that.

Hope that helps otherwise.

ADDED #2: From the NetBSD Wiki, how to use wpa supplicant.

Last edited by IdOp; 24th August 2016 at 11:22 PM.
Reply With Quote