Cubieboard A10 as a router and WiFi hotspot

Good day Habr people, I would like to show the implementation of the router and WIFI access points based on miniPC Cubieboard A10. On this topic, quite a lot of manuals both on Habré and on the Internet but could not be found in full working instructions.


What is available:

Router: the good old Dlink - Dir 300 with the latest firmware, faithfully for a long time he served me, his replacement was the fact that more and more devices appeared in the house that supported the WIFI 802.11 n standard, and he had problems with it In full configuration, he gave out a speed of 75 Mbps, it was connected with 1 antenna.

To replace it, the Cubieboard A10 was also purchased. During the events, two WIFi USB modules TP-LINK721N and TP-LINK722N were purchased.

Let's proceed with the installation:

On a clean Cubieboar, install Cubian memory in NAND (this is a Debian-based OS for this miniPC). I think there shouldn’t be any misunderstandings since there is a very good manual on github, and I installed it with the help of it, the only thing that I had difficulty was that it still loaded only from the memory card, I solved it by editing the file / boot / uEnv.txt, in it the second line was rewritten something like this

root=/dev/nandb rootwait


We boot already from NAND memory, and configure the network, in many manuals there is a way using the bridge, but this method suited me when in my bundle, for the trial time, was Dir-300, that is, the Internet - Dir-300 - Cubieboar- -PC, if you remove Dir-300 from this bundle and do it using a bridge, then cubieboard could not ping the main gateway of my provider, and I solved this problem using NAT,

my / etc / network / interfaces file looks like this:

# the loopback interface
auto lo
iface lo inet loopback
# Карта провайдера 
auto eth0
iface eth0 inet static
address 178.210.208.39 
netmask 255.255.255.128 
gateway 178.210.208.1
dns-nameservers 178.210.192.2
pre-up ifconfig eth0 down hw ether 02:c3:0b:82:c1:cb
auto wlan2 #wifi карта
iface wlan2 inet static
address 192.168.0.1
netmask 255.255.255.0


I would like to draw attention to this line

pre-up ifconfig eth0 down hw ether 02:c3:0b:82:c1:cb


In Cubiane, there is an assignment of random MAC addresses (I don’t know why), but my provider uses MAC address binding and on this one, before turning on the card, it sets my poppy address.

After that we reboot the network

 sudo /etc/init.d/networking restart


You also need to add dns addresses

sudo nano /etc/resolv.conf


and enter your dns addresses by type

nameserver ip dns сервера
nameserver ip dns сервера


Configuring NAT: We

write the iptables rule to autoload for POSTROUTING.

sudo nano /etc/rc.local


And enter

/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE


Also in the file
sudo nano /etc/sysctl.conf


uncomment the line

net.ipv4.ip_forward=1


After that we try to ping something

ping google.com


if the pings pass very well.

At this stage, we have a Cubieboard with the Internet, we will further implement WIFI hotspot using hostapd.

Install hostapd.

You can install it from the repositories, but there it is a very old version and it is not stable, and it does not support 802.11n, so I suggest compiling it:

git clone git://w1.fi/srv/git/hostap.git

before compilation, we will add 1 new parameter to the configuration file so hostapd only works on 40 Mhz (it will provide us with a speed of 150 Mbps)

I personally don’t know how to use patch, so I copied and pasted it from the bug tracker

dev.openwrt.org/ browser / trunk / package / hostapd / patches / 400-noscan.patch? rev = 33392

after that

cd hostap/hostapd
cp defconfig .config
nano .config


We need to add a line
CONFIG_IEEE80211N=y


and can compile
sudo make


after compilation add the configuration file

nano conf


here is my file

interface=wlan2
driver=nl80211
ssid=SupaAP
country_code=RU
hw_mode=g
macaddr_acl=0
auth_algs=1
logger_syslog=-1
logger_syslog_level=3
logger_stdout=-1
logger_stdout_level=2
ignore_broadcast_ssid=0
ieee80211n=1
ht_capab=[HT40-][HT40+][SHORT-GI-40][RX-STBC1][DSSS_CCK-40]
channel=7
wmm_enabled=1
noscan=1
wpa=1
wpa_passphrase=PASSWORD
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP


A complete list of configuration file values ​​and a description can be found on the official website ( link ),

after which we try to run

./hostapd conf


Check for performance. Since we do not have a DHCP server, we need to enter the settings manually, in the DNS field I set the DNS of my provider, after these manipulations I got the Internet, and I immediately began to test the speed, and was very upset.

The speed indicators were, to put it mildly, not very, and with a bit of magic, on WIFI the download speed was about 1.2 Mbit / s where the Dir-300 downloaded 3.5 Mbit / s, I sinned on USB WIFI adapters they say smart people were right both in form and on Habré is skeptical of this kind of venture, but trying to directly download wget was stunned, the speed did not exceed 300 kbit / s, at least it was strange. This problem was in the core of Cubian itself, I replaced the core with the core of the so-called Roman (https://romanrm.net/a10) and the speed increased to 6.9 Mbit / s via wget, and to 4-5 Mbit / s by WIFI that at least a little cheered me up.

Conclusions:

Cubieboard does not make sense to implement an access point as a router and Wifi, it does not give a big increase in speed, and even with that kind of money you could buy an average router much quicker. But in this work I did not pursue these goals and motives, the goal was to work with a nix-like system and console which was more than enough for me, then the cube will continue to be used as a router for me, nginx + apache is now spinning on it for testing my web applications and so on.

Also popular now: