WIFI Access Point on FreeBSD 9 and run driver

Hello everyone.
I'm trying to set up a WIFI Access Point on my FreeBSD 9 machine.
First, I using a simple USB card with urtwn(4), but on FreeBSD 9 there is no driver.

Next I take from work a USB Tp-link card with uses zyd(4) driver, no results.

So I bought Runlink USB WIFI Adapter, that using run(4) driver that supports hostap mode ( I've read that ).

Unfortunately when I setting up a pseudo interface like that:
ifconfig wlan0 create wlandev run0

There is an error:
Code:
ifconfig: wlandev: bad value

I have done Kernel rebuild, so maybe it's a problem?

Please help me, I'm frustrated.
Cheers

-- Edit ---
Ok, there is a progress.
I do it like this:
ifconfig wlan0 create wlandev run0 wlanmode hostap
ifconfig wlan0 inet 192.168.0.1 netmask 255.255.255.0 ssid UNITI mode 11g channel 1
ifconfig bridge0 create addm wlan0 addm em0 up
ifconfig bridge0 inet 192.168.1.1 netmask 255.255.255.0
service hostapd start
service isc-dhcpd start


And then all my devices see my network and can connect to it.
But, when connected the local network working fine, but there is no route to global Internet.

--- Edit ---
Ok, i solve this by adding into pf.conf
Code:
ext_if = "en0"
int_if = "wlan0"
internal_net = "192.168.0.0/24"
nat on $ext_if from $internal_net to any -> ($ext_if)
 
Last edited by a moderator:
I don't know if your question was intended for RALink on FreeBSD9 or just generally. Here is what I have found.

I bought some RALink USB fobs to learn ARM on Beaglebone and FreeBSD wireless AP.
I paid about $5-$15US for the USB adapters.
RT3070-Internal antenna 1T1R----http://www.ebay.com/itm/171836097323
RT5370-External Antenna 1T1R----http://www.ebay.com/itm/131571928930
RT5592(Sold as RT5572)Internal Antenna 2T2R----http://www.ebay.com/itm/291559100340

I was testing on FreeBSD11-CURRENT as Beaglebone is best supported there. There was a small problem where wlan_amrr.ko had to be hand loaded, but this is cutting edge, so expected. That said it works fine in hostapd mode. The range on the USB fobs with no external antenna was poor. In a 1200sf home it struggled at the farthest ends(35ft.). The RT5370 actually came out fastest for me and was quite usable. I tried to force it to HT40 mode before finding this info-

"The run driver does not support any of the 802.11n capabilities offered
by the RT2800, RT3000 and RT3900 chipsets."
https://www.freebsd.org/cgi/man.cgi?run

All my devices use the RT3070 firmware blob so no 802.11n mode.
 
  • Thanks
Reactions: Oko
Hi,
the WiFi network I have been created work super fast but very often something killing the connection.
It's looking like a DHCP server fault, but I can't find any issue in logs.
As above, I can't run USB Card in 802.11n, but 802.11g with external antenna works very well.
 
What are you using for DHCP server if I might ask? I used ISC DHCP server.
Could you tell us what is your hardware? Generic or Branded?
Single Antenna Jack(1T1R or 2T2R)?Do you have dual band 2.4/5ghz? Is your antenna an rubber duck or other? Chipset showing in FreeBSD?


The RT5592 I tested above had the best specifications on paper but the internal antenna made in very limited in range. I was tempted to open the USB fob to see if I could get a pair of antenna jack pigtails soldered on. This chipset also had both 2.4 and 5ghz channels. That means 802.11g and 802.11a
 
Hi.
Yes I using net/isc-dhcp43-server too.
I have a old HP Compaq mini PC.
As WiFi card I use Ralink adapter with single omnidirectional antenna.
Here is my message log:
Code:
Dec 15 18:31:00 uniti kernel: run0: <1.0> on usbus6
Dec 15 18:31:00 uniti kernel: run0: MAC/BBP RT5390 (rev 0x0502), RF RT5370 (MIMO 1T1R), address 00:87:32:64:91:e3
Dec 15 18:31:00 uniti kernel: run0: firmware RT3071 ver. 0.33 loaded
The range of signal is very good for my home, but disconnections is very annoying.

server.jpg
 
I too had troubles with the ISC offering and instead used dns/dnsmasq.
I am sure it was a matter of getting the config right, but for me it was easier just to choose another dhcp server option.
 
Last edited:
Thanks for the help.
Yes, dns/dnsmasq is better solution for me right now. It's so much faster then ISC.
But my girlfriend's MacBook and a few devices disconnecting sometimes.
I have no idea, maybe in my home is too much devices connected to this WiFi card.
The message log is empty, and my PF configuration is simple now:
Code:
set skip on lo
ext_if="em0"
wlan_if="wlan0"
nat on $ext_if inet from $wlan_if:network to any -> $ext_if
pass out on $ext_if proto tcp all modulate state flags S/SA
pass out on $ext_if proto { udp, icmp } all modulate state
pass in on $ext_if all

And my hostapd.conf
Code:
interface=wlan0
debug=1
hw_mode=g
channel=6
macaddr_acl=0
ignore_broadcast_ssid=0
ssid=UNITI
auth_algs=1
wpa=2
wpa_passphrase=<wifi_password_here>
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP TKIP
rsn_pairwise=CCMP

There is a 2 interfaces:
run0 7657 errors / 1745 losts
wlan0 5622 errors / 0 losts

Cheers
 
http://adrianchadd.blogspot.com.ee/2015/09/porting-wifi-driver-from-openbsd-ar9170.html
I told myself a long, long time ago that I really don't want to be working on USB wireless. It's not that I dislike USB or wireless; it's just that the hoops required to get it all working in a stable way is quite a bit to keep in your mind.

There are a few pieces to think about when porting a USB driver. The biggest piece is that it's not memory mapped IO or IO port based - everything is a message. There are USB device control commands you can send which will sleep until they're done, but the majority of stuff is done using bulk transmit and receive endpoints and that's all conveniently asynchronous. But it complicates things in the driver world.

Memory mapped and IO port drivers treat device IO as this magical "I do it, then the next instruction executes when it's done" mostly serialised paradigm. It's a lie, of course - the intel x86 CPUs will pretend things are occuring in a specific order, but a lot of platforms require you to mark memory as uncached or use memory / cache flush operations to ensure things go out to the device in any particularly controlled manner. But USB doesn't - outside of USB control transfers, USB devices tend to look like remote network devices and this includes register accesses.

Adrian Chadd is one of the FreeBSD developers and also wireless maintainer. His blog is really fascinating and educational reading material.

If I was you, I would stop trying to use USB for hostap. I've noticed before that all sorts of USB network devices are not the most stable, be it wireless or Ethernet, his blog explained to me why it tends to be so.

There is google doc https://docs.google.com/spreadsheet/ccc?key=0AojFUXcbH0ROdHgwYkFHbkRUdV9hVWljVWl5SXkxbFE&hl=en

It contains list of wireless chipsets and their capabilities (for FreeBSD)
 
Back
Top