Димитър Мазнеков Posted November 24, 2017 Posted November 24, 2017 (edited) On 9/2/2017 at 6:38 PM, digitalsuper8 said: So here's a more detailed explanation for getting the Nanopi Neo Air to act as wifi accesspoint after boot. I used the FergusL scripts for inspiration and for understanding the contents of the various conf files needed. So after disabling hostapd and dnsmasq I wrote the following bash script, in the directory /usr/local/bin/. It's called neoaccesspoint. sudo nano /usr/local/bin/neoaccesspoint #!/bin/bash PATH="$PATH:/usr/bin/" case "$1" in start) # Assumption: NetworkManager systemd service is stopped and disabled # Assumption: dnsmasq is disabled from startup # Assumption: hostapd is disabled from startup # We first have to bring wlan0 down echo "Bringing wlan0 down" ifdown wlan0 # Then remove the dhd module and load it again in operating mode 2 echo "removing module dhd and doing modprobe dhd op_mode2" rmmod dhd modprobe dhd op_mode=2 # we then have to bring wlan0 up again for it to get an IP address echo "bringing wlan0 up again" ifup wlan0 # We then bring up hostapd echo "starting hostapd" /bin/systemctl start hostapd # And we start dnsmasq echo "starting dnsmasq" #/usr/sbin/dnsmasq /bin/systemctl start dnsmasq ;; stop) # type any commmand echo "Stopping MyAP_Startup service: stopping dnsmasq and hostapd and bringing down wlan0" /bin/systemctl stop hostapd /bin/systemctl stop dnsmasq ifdown wlan0 ;; restart) $0 stop $0 start ;; esac exit 0 Then I created a service file in /lib/systemd/system/ sudo nano /lib/systemd/system/neoairaccesspoint.service the contents: [Unit] #This file has to be in /etc/systemd/system/ Description=Manage the neoairaccesspoint script # Example After statement, this unit only starts after the speficied units are active #After=syslog.target network.target [Service] #Type=forking Type=oneshot ExecStart=/usr/local/bin/neoairaccesspoint start RemainAfterExit=true ExecStop=/usr/local/bin/neoairaccesspoint stop ExecReload=/usr/local/bin/neoairaccesspoint restart # We probably don't want to specify the user here #User=npi [Install] WantedBy=graphical.target I enabled this service by the following commands: sudo systemctl daemon-reload sudo systemctl enable neoairaccesspoint.service This should do it after reboot: sudo systemctl reboot Hope it works for you. Of course you have to have your conf files correct for: hostapd.conf dnsmasq.conf and /etc/network/interfaces There is an error - service try to start /usr/local/bin/neoairaccesspoint, but file is named neoaccesspoint. Also at Armbian 5.31 dnsmasq is not as service and must be started with /usr/sbin/dnsmasq. Becouse of that at stop must be killed process by ID dnsmasq like kill -9 `cat /var/run/dnsmasq.pid` Edited November 24, 2017 by Димитър Мазнеков
Recommended Posts