Good time of day Habra people, I would like to show the implementation of the router and WIFI access point based on miniPC Cubieboard A10. On this topic, quite a lot of manuals both on Habré and on the Internet, but it was not possible to find fully working instructions.
What is available:
Router: good old Dlink - Dir 300 with the latest firmware, faithfully for a long time, he served me, replacing it was the fact that the house had more and more devices that supported the WIFI 802.11 n standard, and he had problems with this, with full configuration gave out a speed of 75 Mbit / s, it was connected with 1 antenna.
')
To replace it, Cubieboard A10 was purchased. During the events, two WIFi USB modules TP-LINK721N and TP-LINK722N were also acquired.
Proceed to install:
On a clean Cubieboar, we install Cubian NAND memory (this is a Debian based OS for this miniPC). I think there shouldn't be any incomprehensibility as there is a very good manual on github, I set it with the help of it, the only thing that I had difficulty was that it still loaded only from the memory card, I decided this by editing the file / boot / uEnv.txt, in it the second line was rewritten like this
root=/dev/nandb rootwait
We are already loading from NAND memory, and we are setting up a network, in many manuals there is a way using a bridge, but this method came up to me when in my bundle, for trial times, there was Dir-300, that is, the Internet - Dir-300 - Cubieboar- -PC, if Dir-300 is removed from this bundle and the cubieboard could not be pinging the main gateway of my provider using a bridge, and I solved this problem using NAT
My / etc / network / interfaces file has the following form:
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 the MAC address binding and at this, before setting up the card itself, it sets my MAC 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
NAT setup:
We write the rule iptables in autoload for POSTROUTING.
sudo nano /etc/rc.local
And we 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 you pass ping very well.
At this stage, we have Cubieboard with the Internet will continue to implement WIFI hotspot using hostapd
Install hostapd
You can install from repositories, but there is a very old version there and it is not stable, and poorly supports 802.11n so I propose to compile it:
git clone git://w1.fi/srv/git/hostap.git
Before compiling, add 1 new parameter to the configuration file, so that hostapd works only on 40 Mhz (it will provide us with a speed of 150 Mbit / s)
I personally do not know how to use patch for this copied and pasted with my hands from a bug tracker
dev.openwrt.org/browser/trunk/package/hostapd/patches/400-noscan.patch?rev=33392thereafter
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 descriptions can be found on the official website (
link )
after that we try to run
./hostapd conf
Check for performance. Since we do not have a DHCP server, you 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 good, and with a bit of magic, WIFI download speed was about 1.2 Mbit / s where Dir-300 downloaded 3.5 Mbit / c, I sinned on USB WIFI adapters that they were right smart people on both form and Habre skeptical about this kind of venture, but on a straight line trying to 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, 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 / c by WIFI that even a little cheered me up.
Findings:
Cubieboard doesn’t have a chance to implement it as a router and Wifi access point, it doesn’t give a big increase in speed, and for that kind of money you could buy an average router where it’s faster. But in this paper I did not pursue these goals and motives, the goal was to work with nix with a similar system and with a console which was more than enough for me, then the cube will continue to be used as a router for me, on it now nginx + apache is spinning to test my web applications and so on.