c347 Manually connecting to a wireless WPA-protected network. - The FreeBSD Forums
The FreeBSD Forums  

Go Back   The FreeBSD Forums > Server & Networking > Networking

Networking Network related discussions (including general TCP/IP stuff, routing, etc).

Reply
 
Thread Tools Display Modes
  #1  
Old August 3rd, 2012, 19:37
niflheim niflheim is offline
Junior Member
 
Join Date: Aug 2012
Location: Sweden
Posts: 4
Thanks: 1
Thanked 3 Times in 2 Posts
Default Manually connecting to a wireless WPA-protected network.

Hello everyone,
I am completely new to both FreeBSD and this forum so please bear with me. I believe I am following the forum rules and guidelines, but please forgive me if I'm doing something wrong.

I have successfully installed FreeBSD-9.0-STABLE on my ASUS 1225B laptop and I have created the kernel modules (is it "modules" or "drivers"?) for my Broadcom wireless network adapter (BCM4313) using ndisgen. In order to use these modules I placed them in the /boot/modules/ directory, and created the following /etc/rc.d script (I first tried to load the modules from /boot/loader.conf, but doing so the kernel wouldn't boot at all):
Code:
#!/bin/sh

# PROVIDE: bcm4313
# REQUIRE: NETWORKING
# BEFORE: LOGIN
# KEYWORD: nojail

. /etc/rc.subr

name="bcm4313"
start_cmd="${name}_start"
stop_cmd=":"

bcm4313_start()
{
   echo "Loading Broadcom BCM4313 NDIS kernel modules."
   kldload bcm43xx64.cat.ko
   kldload bcmwlcoi64.dll.ko
   kldload bcmwl564_sys.ko
}

load_rc_config $name
run_rc_command "$1"
I then added the following lines to /etc/rc.conf:
Code:
wlans_ndis0="wlan0"
ifconfig_wlan0="WPA SYNCDHCP"
And the following lines to /etc/wpa_supplicant.conf:
Code:
network={
   ssid="<router name>"
   psk="<router wpa key>"
}
Now, by doing this I had a fully established wireless connection as soon as I had logged in to FreeBSD (I am saying "had" because I have since reinstalled the whole system; I have recreated the /etc/rc.conf and /etc/wpa_supplicant.conf files exactly as they were, however I don't remember exactly how I wrote the /etc/rc.d script, and I believe that the modules are being loaded a little too soon or too late, because I now end up with a kernel panic a couple of seconds after the login screen appears, but this is not why I am writing this thread).

My question is; since I am running the system on a laptop that I will carry with me, I may want to connect to a wireless WPA-protected network on the spot, without having to reboot the system. How exactly do I do that? I assume that no matter what I will always have to edit /etc/wpa_supplicant.conf to match the network I am trying to connect to, but other than that, how? This is what I have tried so far:
Code:
# ifconfig wlan0 create wlandev ndis0
# ifconfig wlan0 up
# wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf
# dhclient wlan0
The first two ifconfig commands are successful, I am able to scan for and find wireless networks. However I seem to be missing something, because the wpa_supplicant command doesn't seem to work; I expect it to finish, and allow me to continue writing commands to the terminal, which it doesn't. Because of that I tried to run it like this:# wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf -B
I now expect wpa_supplicant to have associated wlan0 with the router, but it hasn't. Here is the output of:# wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf -dd
Code:
Initializing interface 'wlan0' conf '/etc/wpa_supplicant.conf' driver 'default' ctrl_interface 'N/A' bridge 'N/A
Configuration file '/etc/wpa_supplicant.conf' -> '/etc/wpa_supplicant.conf'
Reading configuration file '/etc/wpa_supplicant.conf'
Line: 1 - start of a new network block
ssid - hexdump_ascii(len=7):
   4e 45 54 47 45 41 52
PSK (ASCII passphrase) - hexdump_ascii(len=13): [REMOVED]
PSK (from passphrase) - hexdump(len=32): [REMOVED]
Priority group 0
   id=0 ssid='NETGEAR'
Own MAC address: 00:08:ca:ef:f4:22
wpa_driver_bsd_del_key: keyidx=0
wpa_driver_bsd_del_key: keyidx=1
wpa_driver_bsd_del_key: keyidx=2
wpa_driver_bsd_set*countermeasures: enabled=0
RSN: flushing PMKID list in the driver
Setting scan request: 0 sec 100000 usec
EAPOL: SUPP_PAE entering state DISCONNECTED
EAPOL: Supplicant port status: Unauthorized
EAPOL: KEY_RX entering state INITIALIZE
EAP: EAP entering state DISABLED
EAPOL: Supplicant port status: Unauthorized
EAPOL: Supplicant port status: Unauthorized
Added interface wlan0
State: DISCONNECTED -> SCANNING
Starting AP scan for wildcard SSID
EAPOL: disable timer tick
EAPOL: Supplicant port status: Unauthorized
After this output it just hangs, and I have to press CTRL-C to force it to stop. I would really appreciate all the help I can get. I feel like I've been staring myself blind at all the man pages etc.

Sorry for a long post and thanks in advance.
Reply With Quote
The Following User Says Thank You to niflheim For This Useful Post:
cpu82 (August 19th, 2012)
  #2  
Old August 3rd, 2012, 22:55
niflheim niflheim is offline
Junior Member
 
Join Date: Aug 2012
Location: Sweden
Posts: 4
Thanks: 1
Thanked 3 Times in 2 Posts
Default

I just stumbled across the answer myself. Apparently there are more options for wpa_supplicant than mentioned in the man pages; I found what I needed in the /etc/rc.d/wpa_supplicant script. My wlan0 is now associating with the network and I can run dhclient perfectly fine. Here is the complete command :# wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf -D ndis.

Cheers!
Reply With Quote
  #3  
Old August 19th, 2012, 15:44
cpu82's Avatar
cpu82 cpu82 is offline
Member
 
Join Date: Jul 2011
Location: Granada, ES
Posts: 865
Thanks: 173
Thanked 303 Times in 234 Posts
Post

Quote:
Originally Posted by niflheim View Post
I just stumbled across the answer myself. Apparently there are more options for wpa_supplicant than mentioned in the man pages; I found what I needed in the /etc/rc.d/wpa_supplicant script. My wlan0 is now associating with the network and I can run dhclient perfectly fine. Here is the complete command :# wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf -D ndis.

Cheers!
You forgot "-B" (daemonize) option to starting manually.

If you prefer to start wpa_supplicant when the system booted, add this line in /etc/rc.conf
Code:
wpa_supplicant_enable="YES"
Then you don't need type above commands.
Reply With Quote
Reply

Tags
bcm4313, ifconfig, wpa_supplicant

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Network / wireless frustrations FreeBCP Mobile Computing 7 September 11th, 2011 19:00
Connecting to wireless zjames Networking 11 September 9th, 2010 01:25
Setting up network manually? I need of some help Gogeden Networking 6 May 24th, 2010 00:26
[Solved] Problem connecting to wireless network bojinov Networking 2 December 8th, 2009 12:09
Best way to automate connecting to a wifi network kpedersen Networking 5 October 20th, 2009 12:11


All times are GMT +1. The time now is 22:16.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.
Web protection and acceleration provided by CloudFlare
0