Setting up hostapd on CentOS / BPI-R2

Now that I got the CentOS lite image up and running (thanks frank-w!), I would like to set it up as an access point.

From what I know, hostapd is very good to use. However, there seems to be no CentOS package for it. And if there is, I can’t find a good epel to install it though yum.

I’ve tried compiling it myself, but the compiling stops with these errors:

/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.8.5/../../../libcrypto.so: undefined reference to `deflateInit_'

/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.8.5/../../../libcrypto.so: undefined reference to `inflateInit_'

/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.8.5/../../../libcrypto.so: undefined reference to `zError'
collect2: error: ld returned 1 exit status
make: *** [hostapd] Error 1

Thanks for your help. The BPI-R2 has been an amazing learning curve so far.

ta, t.

answer: install the CentOS repo for armhf.

url -> https://wiki.centos.org/SpecialInterestGroup/AltArch/armhfp?action=show&redirect=SpecialInterestGroup%2FAltArch%2FArm32#head-2c416cfaecdf675f43a5be7a81ad50e81e640c93

I don’t use centos…imho you using official centos7-image…

Have you tried this: https://www.centos.org/forums/viewtopic.php?t=64998 ?

To get wifi-ap you have to use kernel with wifi-driver build in (what says “uname -a”?) and wmt-tools for creating ap0-device…more in my wiki on wlan-page

Thanks again for a quality reply.

I got hostapd installed, when I found the right epel to install, which is not easy if you’re using the armv7 port of CentOS/RHEL. I am not an experienced CentOS user, but this has been a good learning curve.

Sadly, I can’t get the access point up and running with hostapd. If you know of any good documentation for any OS with hostapd, please let me know.

In the meantime, I’ll keep hacking away at it.

as i said…first create the ap0-device like described in my wiki…maybe you have to copy wmt-files to your system

https://www.fw-web.de/dokuwiki/doku.php?id=en:bpi-r2:wlan

Trying to get this going on CentOS and it’s not going well.

There seems to be no ap0 on CentOS, but they have bond0 (which looks fine). Great, for bond0 you need the bonding module. It should be no problem, but it is.

I can’t load the bond module since grub or grub2 doesn’t seem to exist on that CentOS version, instead it’s still booting from the old kernel (4.4.70), and not into the CentOS 7.5 kernel (4.14.28) – which has the bond module. I can’t find the bond module in the 4.4.70 /usr/lib/modules, and yum search or install doesn’t seem to know about it.

I don’t know if this CentOS armv7hl is an unholy mess (it’s not a problem with CentOS intel), but it could be and I don’t like wasting my time with badly engineered products. I’ll keep at it, but if it’s too much a waste of time, I’ll put on debian stretch – I’ll just need a bigger sd-card as the .img is too big for my 8 gig card.

answer -> I was on the totally wrong track here.

Bond0 is not ap0…you have to create ap0-device with wmt-tools like described in my wiki: https://www.fw-web.de/dokuwiki/doku.php?id=en/bpi-r2/wlan

Arm-devices using uboot as bootloader not grub. To load differen kernel you can modify kernel-var in /boot/bananapi/bpi-r2/linux/uEnv.txt. make sure /boot is mounted /dev/mmcblkxp1.

In my /boot I only have this:

root@bpi-iot-ros-ai boot]# ls -la total 604 dr-xr-xr-x 3 root root 4096 Apr 12 00:31 .

dr-xr-xr-x 19 root root 4096 May 29 07:07 …

drwxr-xr-x 2 root root 4096 Feb 24 18:47 extlinux

-rw-r–r-- 1 root root 603279 Jan 12 14:51 initrd-plymouth.img

Thus, it seems setting up to have CentOS boot from another kernel is how things were done 25 years ago, like with Slackware.

It’s a massive learning curve, sadly, I don’t have the hours and hours and hours to waste time on this

answer -> totally wrong track. things work differently, much more so, on the arm platforms than on the intel platforms.

this is in some official images…/boot contains data which is not used…

Rename /boot create an empty /boot and mount /dev/mmcblk0p1 to it

I tried patching the 4.4.70 kernel, following the instructions on http://www.fw-web.de/dokuwiki/doku.php?id=en/bpi-r2/wlan

The instructions are very well written and I was able to do it with no problem.

However, when the device booted up with: 1) CentOS yum updated to 7.5 and 2) the patched kernel, it did something to my router (TP-Link AC1750 Ver. 2, using OpenWRT 17.01.4) and the whole network died. I had to take the bpi-r2 device off the network, and all was fine again.

I wanted to do this to get an access point going.

I started off with the CentOS lite .img.

So far, no joy.

if you use 4.4 kernel, eth0 and eth1 are LAN/WAN directly…in 4.9 and above you have a dsa-driver and eth0/eth1 are only lanes to the switch (mt7530)…your physical ports are lan0-lan3 and wan…

so system looks for and configure lanx and wan which are not present in 4.4 if youre using a newer kernel before

I almost got the AP working – just the dhcpd would not give out an ip. Almost.

However, I have come across this problem again and again and again, on both Ubuntu and CentOS.

When I reboot it, it destroys the whole network with some massive broadcast storm. These are the pings from my pc:

PING 4.2.2.2 (4.2.2.2) 56(84) bytes of data.

64 bytes from 4.2.2.2: icmp_seq=4 ttl=55 time=8327 ms

64 bytes from 4.2.2.2: icmp_seq=5 ttl=55 time=7303 ms

64 bytes from 4.2.2.2: icmp_seq=6 ttl=55 time=6279 ms

64 bytes from 4.2.2.2: icmp_seq=7 ttl=55 time=5255 ms

64 bytes from 4.2.2.2: icmp_seq=8 ttl=55 time=4231 ms

64 bytes from 4.2.2.2: icmp_seq=9 ttl=55 time=3207 ms

64 bytes from 4.2.2.2: icmp_seq=10 ttl=55 time=2207 ms

64 bytes from 4.2.2.2: icmp_seq=11 ttl=55 time=1192 ms

64 bytes from 4.2.2.2: icmp_seq=12 ttl=55 time=168 ms

64 bytes from 4.2.2.2: icmp_seq=13 ttl=55 time=86.4 ms

64 bytes from 4.2.2.2: icmp_seq=14 ttl=55 time=86.6 ms

When the unit is unplugged from the network, the ping times go back to normal.

No, this is not happening sadly.

Have your ap0 an ip-address?

I do not know why your r2 create a broadcast-storm or the latency is so high…

Yes, I put an ip on the ap0, following your instructions.

Question: If I download the CentOS-lite img from your Google Drive directory, do I still need to compile and to apply the kernel patch, according to the instructions on your wiki?

And, on the ap0, must there be a dhcpd when I already have a dhcpd on the network router?

This crazy broadcast-storm problem I’ve had other times as well, like rebooting after an apt upgrade or a yum update (before doing the ap0 patch). I’ve had it on a new and old micro SD-card.

The centos on my drive is simply a copy of official one (because it was only on baidu)… It should have wifi-driver included (4.4.70).

The wmt-tools have to be called on every kernel containing this wifi-driver. We have currently no clue how to create wifi-device without them.

It should be only 1 dhcp in subnet.

I guess after hours and hours of trying, I’ll have to call it a day for the time being with CentOS – the ap think does not work at the moment.

It’s very odd it ignores the static ip I set for it (using nmtui). And if I remove wpa_supplicant (as per the instructions), the whole network stack goes with it and it won’t obtain an ip-number on the next reboot.

I’ll see if I can inch forward on this, using Ubuntu or Debian.

You can’t set staric ip for ap0 the normal way because interface will not exist after reboot. You have to create ap0, set ip, start hostapd and dhcp in a script

Sorry, I meant I tried to set up a static IP for eth0. The bpi-r2 completely ignored that setting, and used the dhclient.

After disabling wpa_supplicant, I tried to set an IP for wlan0, the bpi-r2 crashed on me (had to power cycle it).

If it doesn’t work, it just doesn’t work. I really hope the code will mature.

Wpa-supplicant must be removed if using internal wifi as accesspoint else it will crash.

I have setup dhcp-client on lan-ports in higher kernels. I don’t know centos much as all my systems are debian/ubuntu. But it shoild also work…please post your settings/configfile else nobody can help you…

From what I understand – the dhclient has been baked into the kernel? Well, that explains why the system ignores the /etc/sysconfig/network_scripts/ifcfg-eth0 file.

If you remove wpa_supplicant on CentOS, you remove many other network related programs and on reboot, the bpi-r2 won’t request an ip number. That is why CentOS, in my opinion, won’t work in this access point hack.

Otherwise, the CentOS lite OS works very well and it is very stable. If I can’t use it as a modest access point for a home/stub network, then there are many other functions it can do.

And one modest request: would it be possible to have bpi-r2 .img lite files for Debian and Ubuntu as well? I have no need for the desktop, as I don’t with CentOS.

For debian there is an official jessie lite and a stretch i’ve created (it is not named lite but also minimal)