I've followed this guide to enable both AP and client modes in my RPi 3 at the same time, and it's working fine (some tweaking involved). But now I'm trying to start the AP on boot, which is covered in the guide adding a script to rc.local. Thing is, it's not working. The script is firing, but the AP is not starting. I removed it from rc.local and wrote a service unit for systemd, which doesn't seem to be firing at all (on boot). If I manually start the service (
sudo service accesspoint start) it works as intended, so the problem is that it's not starting the service on boot. If I call
sudo service accesspoint status -l after boot, it shows:
● accesspoint.service - Access Point Service Loaded: loaded (/lib/systemd/system/accesspoint.service; disabled) Active: inactive (dead)
After manually starting it, it shows:
● accesspoint.service - Access Point Service Loaded: loaded (/lib/systemd/system/accesspoint.service; disabled) Active: active (running) since Mon 2016-12-05 10:58:17 COT; 6s ago Main PID: 1550 (bash) CGroup: /system.slice/accesspoint.service ├─1550 /bin/bash /usr/local/bin/hostapdstart └─1737 hostapd /etc/hostapd/hostapd.conf
So it's definitely not being called on boot. The service unit file is as follows:
[Unit] Description=Access Point Service After=multi-user.target [Service] Type=idle ExecStart=/bin/bash /usr/local/bin/hostapdstart [Install] WantedBy=multi-user.target
I have a similar service unit managing the GPIO, and it works fine, it starts on boot without problem. Maybe it has to do with the order of execution? I don't know enought about how linux works to find out where it's failing to start, so I'll include the hostapd start script aswell:
#!/bin/bash PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin iw dev wlan0 interface add uap0 type __ap service dnsmasq restart sysctl net.ipv4.ip_forward=1 iptables -t nat -A POSTROUTING -s 10.0.0.0/24 ! -d 10.0.0.0/24 -j MASQUERADE ifup uap0 hostapd /etc/hostapd/hostapd.conf
I guess the problem is that it's failing to create the
uap0 device, since it's not showing on
ifconfig (that is, if the script is being called at all). So any insight about what can be going wrong would be greatly appreciated.
BTW, I'm running Raspbian Jessie Lite on a Raspberry Pi 3.