Bananian

Setting up wlan0 as an access point in BPI-R1

35 21880
lmsilva  
All,

Just wanted to share my experiences in getting wlan0 on BPI-R1 to work as an access point!
Basically, I followed the instructions on this website:
http://bogeskov.dk/UsbAccessPoint.html

The hostapd binary from Debian's repo doesn't include the necessary drivers so we have to download them from Realtek's website:
http://www.realtek.com/downloads ... oads=true#RTL8192CU

And then:
  1. unzip RTL8192xC_USB_linux_*.zip
  2. tar zxvf RTL8188C_8192C_USB_linux_*/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8_rtw_*.tar.gz
  3. cd wpa_supplicant_hostapd-0.8_*/hostapd/
  4. make
  5. sudo cp hostapd hostapd_cli /usr/local/sbin/
Copy the Code
And use this as the hostapd.conf file:
  1. ssid=MyAccessPoint
  2. wpa_passphrase=MySecretPassword

  3. ctrl_interface=/var/run/hostapd
  4. interface=@INTERFACE@
  5. bridge=br0
  6. driver=rtl871xdrv
  7. hw_mode=g
  8. channel=6
  9. wpa=2

  10. beacon_int=100
  11. hw_mode=g
  12. ieee80211n=1
  13. wme_enabled=1
  14. ht_capab=[SHORT-GI-20][SHORT-GI-40][HT40+]
  15. wpa_key_mgmt=WPA-PSK
  16. wpa_pairwise=CCMP
  17. max_num_sta=8
  18. wpa_group_rekey=86400
Copy the Code
This worked like a charm for me!

Hope this information can help others!
Thanks for sharing

Edited by denzelcris at Sun Mar 15, 2015 09:42

Hello,

I saw this thread now and I also want to share how I've made my BPI-R1 work as a hotspot, but with dnsmasq.

Firstly, I was just about to recompile the 8192cu wi-fi, when I knowticed that my script worked!
What I think I did:
a) properly set the hardware config to BPI-R1 through their config utility ( caution: you have to press "space" and after "enter" to properly select the hw in the list)
b) enabled the wi-fi modules in etc/modules, here is how mine looks:
  1. # /etc/modules: kernel modules to load at boot time.
  2. #
  3. # This file contains the names of kernel modules that should be loaded
  4. # at boot time, one per line. Lines beginning with "#" are ignored.
  5. # Parameters can be specified after the module name.

  6. # VLAN support for BPI-R1
  7. 8021q

  8. #my enable wifi experiment (should only be appliable for the pro version, does not hurt anything though)
  9. ap6210
Copy the Code
c) did a "cold" reboot of the device (unplug/replug)

Secondly, I had to configure hostapd using the above guide with a script which I've modified to fit dnsmasq.
Here is how they look:
usq/local/sbin/hostapd-start
  1. #!/bin/bash

  2. sed -e "s/@INTERFACE@/$INTERFACE/g" \
  3.         < /etc/hostapd/hostapd.conf \
  4.         > /etc/hostapd/hostapd-$INTERFACE.conf

  5. sed -e "s/@INTERFACE@/$INTERFACE/g" \
  6.         < /etc/dnsmasq-template \
  7.         > /etc/dnsmasq.conf


  8. ifconfig $INTERFACE up
  9. ifconfig $INTERFACE 192.168.150.1

  10. service dnsmasq restart

  11. sysctl net.ipv4.ip_forward=1
  12. iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
  13. iptables -t mangle -A PREROUTING -j TTL --ttl-inc 5

  14. if [ ! -d /var/run/hostapd ]; then
  15.         rm -rf /var/run/hostapd
  16.         mkdir /var/run/hostapd
  17. fi

  18. /usr/local/sbin/hostapd -B -P /var/run/hostapd/$INTERFACE.pid /etc/hostapd/hostapd-$INTERFACE.conf
Copy the Code
etc/hostapd/hostapd.conf
  1. ssid=***
  2. wpa_passphrase=***

  3. ctrl_interface=/var/run/hostapd
  4. interface=@INTERFACE@
  5. bridge=br0
  6. driver=rtl871xdrv
  7. hw_mode=g
  8. channel=6
  9. wpa=2

  10. beacon_int=100
  11. hw_mode=g
  12. ieee80211n=1
  13. wme_enabled=1
  14. ht_capab=[SHORT-GI-20][SHORT-GI-40][HT40+]
  15. wpa_key_mgmt=WPA-PSK
  16. wpa_pairwise=CCMP
  17. max_num_sta=8
  18. wpa_group_rekey=86400
Copy the Code
and /etc/dnsmasq-template
  1. # Bind to only one interface
  2. bind-interfaces
  3. # Choose interface for binding
  4. interface=@INTERFACE@
  5. # Specify range of IP addresses for DHCP leasses
  6. dhcp-range=192.168.150.2,192.168.150.10
Copy the Code
I've basically used the @INTERFACE@ to make things more dynamic, even though the 'wlan0' name is always used.

The wi-fi speeds are very good on this device, I've got about 50 Mbit/s for upload and download.

Hope this helps someone, cheers!

jekader  
thanks for sharing these tips. Do you know if there's any plans to ship a proper realtek driver with bananian to allow users install stock hostapd versions?

jekader  
Quick update: as I hate both old unmanaged software I patched hostapd 2.4 to support the 8192cu driver and packaged it into a .deb file with it.
The github repo with instructions is available here:
https://github.com/jekader/hostapd-rtl

Stybyk  
Hi , is possible to change Tx power to anthene ? I will have 2 separate wifi lan network. Do you think that is possible ? I will have WLAN 1 on 1st anthene and WLAN 2 on 2nd anthene. But i don´t know if it is possible

jekader  
Edited by jekader at Thu Mar 26, 2015 12:42
Stybyk replied at Thu Mar 26, 2015 09:23
Hi , is possible to change Tx power to anthene ? I will have 2 separate wifi lan network. Do you thi ...


Hi, you can define multiple WiFi access points on the same device using hostapd.

Here's a HOWTO - should be super easy to achieve:
http://wiki.stocksy.co.uk/wiki/Multiple_SSIDs_with_hostapd

Basically just add this to the end of your hostapd.conf file:
  1. bss=wlan0_1
  2. ssid=SecondWirelessNet
  3. wpa=2
  4. wpa_passphrase=CantCrackMe
  5. wpa_key_mgmt=WPA-PSK
  6. rsn_pairwise=CCMP
Copy the Code
if you want more networks - just add more sections.

schasch  
Edited by schasch at Tue Apr 14, 2015 06:15

@jekader
thanks for
https://github.com/jekader/hostapd-rtl
...and the other infos...

schasch  
Hi,

I have the AP running, but still 1 little problem.
wlan-client can connet and has access to the nternet.

But a eth-connected pc at the switch is ping'able from  my R1(ssh) and from a connected wlan-client at this AP,
but not by other PCs in the network where the R1 is connect to with eth0.

cat /etc/network/interfaces
        # interfaces(5) file used by ifup(8) and ifdown(8)

        auto lo br0
        iface lo inet loopback
         
        # wireless wlan0
        allow-hotplug wlan0
        iface wlan0 inet manual
         
        # eth0 connected to the ISP router
        allow-hotplug eth0
        iface eth0 inet manual
         
        # Setup bridge
        #iface br0 inet dhcp
        iface br0 inet static
            bridge_ports wlan0 eth0
            address 10.1.7.1
            netmask 255.255.0.0
            network 10.1.0.0
        #    ## isp router ip, 192.168.1.2 also runs DHCPD ##
            gateway 10.1.2.6
            dns-nameservers 10.1.1.20




cat start hostapd.sh
        sysctl net.ipv4.ip_forward=1
        iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
        iptables -t mangle -A PREROUTING -j TTL --ttl-inc 5
        sudo /etc/init.d/networking restart
        /usr/sbin/hostapd -dd /etc/hostapd/hostapd.conf | tee /tmp/hostapd.log &


any ideas?

Tido  

You have to log in before you can reply Login | Sign Up

Points Rules