LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > *BSD
User Name
Password
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.

Notices



Reply
 
Search this Thread
Old 08-05-2011, 11:18 PM   #1
lucmove
Member
 
Registered: Aug 2005
Location: Brazil
Distribution: Debian Wheezy, Slackware
Posts: 604

Rep: Reputation: 70
Wifi setup on FreeBSD


I read the appropriate docs and got something going:

rc.conf:
Code:
# -- sysinstall generated deltas -- # Fri Aug  5 00:22:46 2011
# Created: Fri Aug  5 02:39:14 2011
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
hostname="lucfree"
moused_enable="YES"
sshd_enable="YES"
# -- sysinstall generated deltas -- # Fri Aug  5 04:06:48 2011
hostname="192.168.1.1"
# -- sysinstall generated deltas -- # Fri Aug  5 04:08:18 2011
ifconfig_ath0="inet 192.168.1.1  netmask 255.255.255.0"
defaultrouter="192.168.1.1"
hostname="lucfree"
ifconfig_ath0="DHCP"

# -- sysinstall generated deltas -- # Fri Aug  5 04:53:56 2011
ifconfig_ath0="inet 192.168.1.1  netmask 255.255.255.0"
defaultrouter="192.168.1.1"
hostname="lucfree.lucfree"
# -- sysinstall generated deltas -- # Fri Aug  5 04:55:09 2011
ifconfig_ath0="inet 192.168.1.104  netmask 255.255.255.0"
defaultrouter="192.168.1.1"
hostname="lucfree.lucfree"
wpa_supplicant.conf
Code:
network={
	ssid="mywifispot"
	key_mgmt=NONE
	wep_key1=00myHexPassword
	wep_tx_keyidx=1
}
connect.sh
Code:
ifconfig wlan0 create wlandev ath0
ifconfig wlan0 netmask 255.255.255.0 ssid mywifispot wepmode on weptxkey 1 wepkey 00myHexPassword
# wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf
# The line above is commented out because it doesn't work,
# it just hangs for about a minute then gives up.
But that is not enough. It seems I can't get DNS lookup or DHCP working correctly:
Code:
Script started on Fri Aug  5 23:41:46 2011

lucfree# sh connect.sh

lucfree# ping www.yahoo.com
ping: cannot resolve www.yahoo.com: Host name lookup failure

lucfree# ifconfig wlan0
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether xx:yy:xx:yy:xx:yy
	inet 0.0.0.0 netmask 0xff000000 broadcast 255.255.255.255
	media: IEEE 802.11 Wireless Ethernet DS/11Mbps mode 11g
	status: associated
	ssid mywifispot channel 6 (2437 MHz 11g) bssid xx:yy:xx:yy:xx:yy
	regdomain 101 indoor ecm authmode OPEN privacy ON deftxkey 2
	wepkey 2:40-bit txpower 20 bmiss 7 scanvalid 450 bgscan
	bgscanintvl 300 bgscanidle 250 roam:rssi 7 roam:rate 5 protmode CTS
	wme burst roaming MANUAL

lucfree# ifconfig ath0
ath0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 2290
	ether xx:yy:xx:yy:xx:yy
	media: IEEE 802.11 Wireless Ethernet autoselect mode 11g
	status: associated

lucfree# dhclient wlan0
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 9
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 13
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 18
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 13
No DHCPOFFERS received.
No working leases in persistent database - sleeping.

lucfree# ifconfig wlan0
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether xx:yy:xx:yy:xx:yy
	inet 0.0.0.0 netmask 0xff000000 broadcast 255.255.255.255
	media: IEEE 802.11 Wireless Ethernet DS/11Mbps mode 11g
	status: associated
	ssid mywifispot channel 6 (2437 MHz 11g) bssid xx:yy:xx:yy:xx:yy
	regdomain 101 indoor ecm authmode OPEN privacy ON deftxkey 2
	wepkey 2:40-bit txpower 20 bmiss 7 scanvalid 450 bgscan
	bgscanintvl 300 bgscanidle 250 roam:rssi 7 roam:rate 5 protmode CTS
	wme burst roaming MANUAL

lucfree# route add default 192.168.1.1
route: writing to routing socket: Network is unreachable
add net default: gateway 192.168.1.1: Network is unreachable

lucfree# netstat -rn
Routing tables
Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
0.0.0.0/8          link#4             U           0        0  wlan0
127.0.0.1          link#3             UH          0        0    lo0
Internet6:
Destination                       Gateway                       Flags      Netif Expire
::1                               ::1                           UH          lo0
fe80::%lo0/64                     link#3                        U           lo0
fe80::1%lo0                       link#3                        UHS         lo0
ff01:3::/32                       fe80::1%lo0                   U           lo0
ff02::%lo0/32                     fe80::1%lo0                   U           lo0

lucfree# cat /etc/resolv.conf 
domain	lucfree
nameserver	192.168.1.1

lucfree# exit
Script done on Fri Aug  5 23:47:59 2011
My Wifi connection works fine on two Linux distros I have been using for several years (using one to post this right now), so hardware failure is ruled out. I am just not well versed in FreeBSD. Anybody help?

Last edited by lucmove; 08-05-2011 at 11:20 PM.
 
Old 08-06-2011, 04:02 PM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora, Lubuntu, FreeBSD
Posts: 3,930
Blog Entries: 5

Rep: Reputation: Disabled
There's a few issues here -- may as well start addressing them one by one.

First, your rc.conf(5) is currently a mess, and needs to be cleaned up. Do not use sysinstall(8) to edit it. Instead, edit it manually. Yours, in particular, should look something like:

Code:
hostname="lucfree.local"    # NOTE that I made it FQ by adding .local
moused_enable="YES"
sshd_enable="YES"

# Use your real WEP key here
ifconfig_ath0="wepmode on weptxkey 3 wepkey 3:0x1234567890 ssid YOUR_SSID DHCP"
The rest of the cruft in there needs to go away. If you configure this manner, you should not need to use wpa_supplicant.conf(5).

---

Second, for WEP, in /boot/loader.conf, add:
Code:
# Technically, only this first module is needed. 
wlan_wep_load="YES"
wlan_ccmp_load="YES"
wlan_tkip_load="YES"
After you've added that, you can avoid a reboot with:
# kldload wlan_wep

---

Third, you don't need a custom script to test this connection. You can use:
/etc/rc.d/netif restart

... and let that process suck in your rc.conf(5). That way you get to test that it's configured correctly at the same time.

---

P.S. WEP sucks. Please consider looking into an AP that supports WPA.
 
Old 08-06-2011, 05:16 PM   #3
lucmove
Member
 
Registered: Aug 2005
Location: Brazil
Distribution: Debian Wheezy, Slackware
Posts: 604

Original Poster
Rep: Reputation: 70
Thank you very much!

However, it still does not work. It got worse, my machine won't even associate with the wifi spot.

It seems to associate when I run the first line of my connect.sh script, but then I'm still stuck in the same problem, no resolving. Note that I can't even ping sites by their IP numbers. I can't even ping the router at 192.168.1.1. The only number I can ping is 127.0.0.1.

Quote:
Originally Posted by anomie View Post
P.S. WEP sucks. Please consider looking into an AP that supports WPA.
I am aware of how weak WEP is, but the access point isn't mine. I inquired the owner about it once, it seems that there is or used to be someone in the house using a machine that cannot/could not use WPA2, so they decided to leave it that way. I figure I had better not meddle in their business. I use SSH tunnels for all my important stuff anyway.
 
Old 08-07-2011, 12:05 PM   #4
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora, Lubuntu, FreeBSD
Posts: 3,930
Blog Entries: 5

Rep: Reputation: Disabled
Sorry, let me take another stab at the rc.conf(5). Try:
Code:
hostname="lucfree.local"    # NOTE that I made it FQ by adding .local
moused_enable="YES"
sshd_enable="YES"

wlans_ath0="wlan0"

# Use your real WEP key here
ifconfig_wlan0="wepmode on weptxkey 3 wepkey 3:0x1234567890 ssid YOUR_SSID DHCP"
And please use /etc/rc.d/netif instead of messing with a custom script. The reasoning is even if you get connect.sh working, you'll have to translate it into rc.conf(5) parlance if you want it to survive a reboot. Might as well kill two birds with one stone.

If it's still not working after the (above) changes, then I recommend starting to eliminate possible causes: make it an open AP, then get that working, so we know the hardware and DHCP server are most likely doing their thing (at which point either the WEP configuration or the WEP driver w/ your hardware are probably causing the issues).
 
Old 08-07-2011, 03:09 PM   #5
lucmove
Member
 
Registered: Aug 2005
Location: Brazil
Distribution: Debian Wheezy, Slackware
Posts: 604

Original Poster
Rep: Reputation: 70
Quote:
Originally Posted by anomie View Post
Sorry, let me take another stab at the rc.conf(5). Try:
Code:
hostname="lucfree.local"    # NOTE that I made it FQ by adding .local
moused_enable="YES"
sshd_enable="YES"

wlans_ath0="wlan0"

# Use your real WEP key here
ifconfig_wlan0="wepmode on weptxkey 3 wepkey 3:0x1234567890 ssid YOUR_SSID DHCP"
And please use /etc/rc.d/netif instead of messing with a custom script. The reasoning is even if you get connect.sh working, you'll have to translate it into rc.conf(5) parlance if you want it to survive a reboot. Might as well kill two birds with one stone.

If it's still not working after the (above) changes, then I recommend starting to eliminate possible causes: make it an open AP, then get that working, so we know the hardware and DHCP server are most likely doing their thing (at which point either the WEP configuration or the WEP driver w/ your hardware are probably causing the issues).
Thank you again. Your new suggestion has been tried here already. It's the recommended procedure in the documentation to which I referred in my first post. It doesn't work. FreeBSD creates wlan0 and claims to be associated with the Access Point, but cannot resolve any address except 127.0.0.1, not even the router at 192.168.1.1. I remember seeing some error message(s) stating that "wlan0 is down" even after I ran 'ifconfig wlan0 up.'

Also, like I said before, I am not allowed to tinker with the Access Point and make it more or less open. I have to use it as is.

I can only blame FreeBSD so far since I have Windows XP and two Linux distros in this very same machine and same network/AP, and the three of them work fine. Four if we count System Rescue CD, which also finds, authenticates and uses my Wifi connection very easily.

Does FreeBSD 8.2 come with any firewall enabled by default? How can I check that? If so, how can I disable it?
 
Old 08-07-2011, 06:00 PM   #6
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora, Lubuntu, FreeBSD
Posts: 3,930
Blog Entries: 5

Rep: Reputation: Disabled
No, there's no firewall enabled by default. You could test to see whether IPFW or PF are loaded pretty easily with:
Code:
# kldstat | egrep ' pf| ipfw'
I don't have any particularly elegant suggestions from here. The way I would troubleshoot it is, as I mentioned, find some way to eliminate possibilities. If the AP can not be reconfigured, can a new one temporarily be brought in? If not, can the computer be temporarily moved?

It's trial and error / tinkering / re-check configurations time. Device support via ath(4) is good, but keep an eye on /var/log/messages for chatter about problems about your wifi device.

Last edited by anomie; 08-07-2011 at 06:01 PM.
 
Old 08-09-2011, 10:09 PM   #7
lucmove
Member
 
Registered: Aug 2005
Location: Brazil
Distribution: Debian Wheezy, Slackware
Posts: 604

Original Poster
Rep: Reputation: 70
I gave up on FreeBSD, tried NetBSD and had the same problem. Then I googled the hell out of it and realized there is no documentation explaining how to set up DHCP on any of the BSDs. Not only that, my google search brought up one or two people making the same complaint.

Finally, I tried OpenBSD. It wouldn't install.

So I gave up on all the BSDs. They hate me. They have for a long time.

Thank you for your attention.
 
1 members found this post helpful.
Old 08-09-2011, 11:47 PM   #8
rocket357
Member
 
Registered: Mar 2007
Location: 127.0.0.1
Distribution: OpenBSD-CURRENT
Posts: 476
Blog Entries: 122

Rep: Reputation: 74
Quote:
Originally Posted by lucmove View Post
I tried OpenBSD. It wouldn't install.

So I gave up on all the BSDs. They hate me. They have for a long time.
Did you report any of the problems you've had? I mean, to the appropriate mailing list?

I know it may not help what you're dealing with here and now, but reporting issues does help open source projects correct errors and become more robust.

I'm actually a bit interested to know how OpenBSD failed, was it a disk controller that wasn't properly recognized? ACPI issues? Just curious...
 
Old 08-10-2011, 02:08 AM   #9
lucmove
Member
 
Registered: Aug 2005
Location: Brazil
Distribution: Debian Wheezy, Slackware
Posts: 604

Original Poster
Rep: Reputation: 70
Quote:
Originally Posted by rocket357 View Post
I'm actually a bit interested to know how OpenBSD failed, was it a disk controller that wasn't properly recognized? ACPI issues? Just curious...
From memory, it was something like this: installer asked me if I wanted to use whole disk or just a DOS partition (slice). I chose slice. Then it asked if I wanted to edit disklabel or (A)uto configure, or something like that. In either case, I got back to the part that asked me whether I wanted to use whole disk or just a slice. I selected slice. Then it asked if I wanted to edit disklabel or (A)uto configure, or something like that... Do you get it? I couldn't get out of that loop.

After four reboots and several attempts at that loop, I got angry and confused and pressed something at random (I know!) and told installer to use the whole disk. Disaster ensued, I watched OpenBSD beginning to format my disk, I pressed Ctrl+c after a few seconds, but of course that was too late. I lost my partition table and maybe one of my slices too. I had backups, but they were not thorough, so I used recovery software to put the disk back in its original state. I recovered all my data. My point is, the installer won't let me install OpenBSD in its own slice, it wants to use the entire disk. Either that or trap me in a loop of the same questions over and over.

If that report is not enough, I can try it again, but not too soon. A few days later.

Last edited by lucmove; 08-10-2011 at 02:09 AM.
 
1 members found this post helpful.
Old 08-10-2011, 11:50 AM   #10
rocket357
Member
 
Registered: Mar 2007
Location: 127.0.0.1
Distribution: OpenBSD-CURRENT
Posts: 476
Blog Entries: 122

Rep: Reputation: 74
The only thing I can think of that would cause that is that OpenBSD is expecting a primary partition and none are available (though that would affect {Net,Free}BSD as well, I would imagine?).

And no worries, there's no need to risk your data again. Thanks for the clarification. =)
 
Old 08-14-2011, 09:29 AM   #11
antiequality
LQ Newbie
 
Registered: Aug 2011
Posts: 4

Rep: Reputation: Disabled
Quote:
Originally Posted by anomie View Post
I recommend starting to eliminate possible causes: make it an open AP, then get that working, so we know the hardware and DHCP server are most likely doing their thing (at which point either the WEP configuration or the WEP driver w/ your hardware are probably causing the issues).
While I normally like your advice here, I disagree on this. He knows others are able to connect to it and his two Linux boxes connect. The AP isn't the problem IMHO.
 
Old 08-14-2011, 09:31 AM   #12
antiequality
LQ Newbie
 
Registered: Aug 2011
Posts: 4

Rep: Reputation: Disabled
Quote:
Originally Posted by lucmove View Post
I gave up on FreeBSD, tried NetBSD and had the same problem. Then I googled the hell out of it and realized there is no documentation explaining how to set up DHCP on any of the BSDs. Not only that, my google search brought up one or two people making the same complaint.
Professional documentation writer here.

BSD's documentation is not written by professionals. It is a volunteer effort. It is not bad, per se, but it's unfriendly.

So are the mailing lists. You will find an attitude of "blame the user."

Not all BSDites are like this. Some recognize that making a server operating system work on the desktop takes more than some verbose documentation and hostile e-lists.

As far as your question, I haven't yet tried WiFi on BSD yet so have no useful information. I am sorry for this.
 
0 members found this post helpful.
Old 08-14-2011, 05:59 PM   #13
lucmove
Member
 
Registered: Aug 2005
Location: Brazil
Distribution: Debian Wheezy, Slackware
Posts: 604

Original Poster
Rep: Reputation: 70
Quote:
Originally Posted by antiequality View Post
BSD's documentation is not written by professionals. It is a volunteer effort. It is not bad, per se, but it's unfriendly.

So are the mailing lists. You will find an attitude of "blame the user."
I know. I won't even try them anymore.

The NetBSD community is the only one that has always struck me as friendly, but it is very small and underpowered, they want to help, but are often unable to. I mean, they usually don't have the answers.

OpenBSD is the most hostile, will actively drive neophites away.

FreeBSD tends to just simply ignore request for help from newbies. They figure everything is in the must-read thousand-page handbook, even if inadequately put, so questions like "how do I set up Wifi" are almost anathema. Even if the official instructions don't work.

I still bother because I like to test operating systems, I'd love to give the BSDs a try. But there are too many obstacles in place.

Thank you.
 
Old 08-15-2011, 10:57 AM   #14
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora, Lubuntu, FreeBSD
Posts: 3,930
Blog Entries: 5

Rep: Reputation: Disabled
Quote:
Originally Posted by antiequality
While I normally like your advice here, I disagree on this. He knows others are able to connect to it and his two Linux boxes connect. The AP isn't the problem IMHO.
Problem is I don't have a FreeBSD installation with wifi these days, so I'm going from my own memory, and from the official docs. If the usual course of configuration doesn't work, the best I could / can offer is my default of starting from the basics and working upward. Even if it does not seem like the most logical approach given all the details together, my experience has been that such an exercise often turns on a little light bulb or two that can help troubleshoot.
 
Old 10-22-2011, 02:19 PM   #15
fatmac
Member
 
Registered: Sep 2011
Location: Surrey/Hants Border, UK
Distribution: AntiX, TinyCore, (& SliTaz)
Posts: 397

Rep: Reputation: Disabled
Try FreeBSD 9.0

It configures wifi as part of the installation.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wifi Setup for Wifi hotspots? business_kid Slackware 4 11-03-2010 04:37 AM
Wifi on Freebsd [Ralink card] holms *BSD 2 11-30-2008 08:01 AM
Wifi card not recognised properly on freebsd 6.2 OBcecado *BSD 5 02-14-2008 10:49 AM
wifi issues: ipw2200, freebsd 6 fenderman11111 *BSD 1 01-24-2006 08:57 PM


All times are GMT -5. The time now is 04:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration