senia Posted February 10, 2017 Posted February 10, 2017 Hello everybody! How can I create access point with nmtui ? I spent some time playing with nmtui, and finally my nanopi got address something like 10.42.0.1. But it doesn't look normal, I can't create default gateway like 192.168.0.1 So, I couldn't see my hotspot from another device( android phone or other pc ) Maybe somebody resolved this problem?
tkaiser Posted February 10, 2017 Posted February 10, 2017 AP6212 has to be brought into AP mode before. Please use custom google search (see my sig) for 'op_mode=2' (should be possible after loading the module through sysfs but I never tested that).
FergusL Posted February 27, 2017 Posted February 27, 2017 Hello! Posting here as it's both the most recent and most precise topic about that issue. I've managed to make two shell scripts to switch between Access Point and client mode for wifi. I hope I haven't forgotten any other settings I've tweaked elsewhere on the system. I'm not using nmcli/tui for creating the AccessPoint since the load option of the module makes this a bit tricky. Instead this is standard hostapd for AP settings + dnsmasq for serving DHCP. As stated in the files, this needs testing as well as checking regarding how to deal exactly with systemd services. Save as stamode.sh, chmod +x stamode.sh and ./stamode #! /bin/sh # Switch from Access Point mode to station mode (client mode to a wifi network) for AP6212. #TODO: Help, review and testers needed, especially for dealing with stopping/killing systemd services and process. # Stop running process for the AP /bin/systemctl stop hostapd kill $(cat /var/run/dnsmasq.pid) # Remove and re-add the wifi module, that time in station mode. rmmod dhd modprobe dhd # Update symlinks for interfaces rm /etc/network/interfaces ln -s interfaces.network-manager /etc/network/interfaces # Start normal network services provided by NM. /bin/systemctl start networking.service /bin/systemctl enable NetworkManager /bin/systemctl start NetworkManager # NM needs to be told to use that interface again /usr/bin/nmcli d set wlan0 managed yes # Wait for wifi to come up and show a list of networks in range sleep 8 /usr/bin/nmcli device wifi list Save as apmode.sh, chmod +x apmode.sh and ./stamode #! /bin/sh # Switch from station mode (client mode to a wifi network) to Acess Point mode for AP6212. # Configuration of hostapd is found in /etc/hostapd/hostapd.conf or wherever the line "DAEMON_CONF" in /etc/default/hostapd points to. # Do not forget to uncomment the line mentioned above in /etc/default/hostapd # Edit /etc/network/interfaces with static IP for wlan0, example conf: # auto wlan0 # iface wlan0 inet static # address 192.168.101.1 # netmask 255.255.255.0 # dns-nameservers 192.168.101.1 # Configuration for DHCP server (using dnsmasq) is found in /etc/dnsmasq.conf, example conf: # dhcp-range=192.168.101.20,192.168.101.120,72h #TODO: Help, review and testers needed, especially for dealing with stopping/killing systemd services and process. # Stop and disable nm. If it's enabled it locks at boot for 5 minutes. # The dnsmasq processes aren't killed when nm stops and keep dhcp from working, kill them! /bin/systemctl stop NetworkManager /bin/systemctl disable NetworkManager kill $(cat /var/run/NetworkManager/dnsmasq.pid) kill $(cat /run/dnsmasq.br0.pid) # Remove and re-add the wifi module, that time in AP mode rmmod dhd modprobe dhd op_mode=2 # Update symlinks for interfaces rm /etc/network/interfaces ln -s interfaces.hostapd /etc/network/interfaces # Start using systemd and manually. Hostapd manages the interface, auth etc. and dnsmasq serves a DHCP server for clients connecting to the AP. /bin/systemctl start hostapd /usr/sbin/dnsmasq 2
StuxNet Posted February 27, 2017 Posted February 27, 2017 I've managed to make two shell scripts to switch between Access Point and client mode for wifi. Awesome dude! I was using FriendlyArm's kernel for awhile there since they accomplished this out of the box. However I've been meaning to tinker with this on Armbian for a while, cuz Armbian is dope,. Just haven't had the time. Thanks for beating me to it. Also, I've been kind of documenting my progress, proof of concept and use case for my NanoPi NeoAir. Now, I hope it's cool but Tkaiser linked me to your post and I immediately made duplicates of your scripts and put them in a gist for personal reference and because I always assume links will die I also reference your scripts in the write up (if you can call it that) meanwhile being sure to give you proper credit I'll be testing these out and give you feedback when my new order comes in the mail. If you have any problem with that lemme know and I'll make changes. Here's the gist: https://gist.github.com/BiTinerary/693b8949ed56d6c534d138b9ba2b837e Here's the reference: https://github.com/BiTinerary/PocketServerPi/blob/master/README.md#installation (Second Paragraph) 1
FergusL Posted February 28, 2017 Posted February 28, 2017 18 hours ago, StuxNet said: Awesome dude! I was using FriendlyArm's kernel for awhile there since they accomplished this out of the box. However I've been meaning to tinker with this on Armbian for a while, cuz Armbian is dope,. Just haven't had the time. Thanks for beating me to it. Also, I've been kind of documenting my progress, proof of concept and use case for my NanoPi NeoAir. Now, I hope it's cool but Tkaiser linked me to your post and I immediately made duplicates of your scripts and put them in a gist for personal reference and because I always assume links will die I also reference your scripts in the write up (if you can call it that) meanwhile being sure to give you proper credit I'll be testing these out and give you feedback when my new order comes in the mail. If you have any problem with that lemme know and I'll make changes. Here's the gist: https://gist.github.com/BiTinerary/693b8949ed56d6c534d138b9ba2b837e Here's the reference: https://github.com/BiTinerary/PocketServerPi/blob/master/README.md#installation (Second Paragraph) That's super fine, thanks for the mention and I'm glad to see it adopted that quickly! I in fact made these script for a projet as well, I'm working on low latency audio software running on the NanoPi. The only thing that has to be double checked in these scripts is the compatibility with other services running with systemd. Yeah please tell me how it works when you've tested it! 1
StuxNet Posted April 13, 2017 Posted April 13, 2017 On 2/28/2017 at 11:15 AM, FergusL said: That's super fine, thanks for the mention and I'm glad to see it adopted that quickly! I in fact made these script for a projet as well, I'm working on low latency audio software running on the NanoPi. The only thing that has to be double checked in these scripts is the compatibility with other services running with systemd. Yeah please tell me how it works when you've tested it! So I've been tinkering with the new guys (NeoAir's) for a couple weeks now, after porting my setup/project from FriendlyArm to Armbian kernel. Everything is going well, with the exception of getting AP Mode to work. (Forget about auto swap AP/Client) I'm sure it's user error on my part. I'm pretty technically inclined in the grand scheme of things, just not the fundamentals of hostapd, dnsmasq, interface configs on Linux. I'm a script kiddy where these are concerned, and `nmtui` comes in handy Anyways, I've gotten as far as getting the NeoAir to broadcast as an Access Point, however when I go to connect (on phone/laptop) it doesn't accept the correct password, or establish a connection even when there is no password. It's my understanding that this is an issue with DHCP/DNSMasq not signing a lease (or whatever the proper lingo is) with another WiFi enabled device. So clearly, something is wrong with my DNSmasq/DHCP configs. I've tried using DNSmasq, isc-dhcp-server and my tech buddy's gist for automating the hostapd/interfaces configs (albeit for a Nano Neo) which all pretty much end with the same results. An SSID that I can't connect to. Again, yes in this regard I'm a script kiddy and if it seems like I'm just taking shots in the dark, it's because I am At any rate, if you'd like me to post configs, I can. I was just hoping that you (FergusL) could post copies of your interfaces, hostapd, etc... so I can have a working setup. Then I could incorporate those (proper, working) configs into my buddies script. So then you, me and anyone else on this forum could run it, have all the proper configs setup (prompt for SSID/password?) and be good to go. Pass along the script kiddie torch Anyways thanks for read my long winded post. Here's a unrelated treat. My buddy also wrote another script for automatically setting up noVNC (SSH in a webbrowser) on h3 boards. I had to add/tinker to get rid of a few error codes but it should work nicely.https://github.com/BiTinerary/PocketServerPi/blob/master/noVNCAutoInstallation.sh Spoiler
LRiedel Posted April 25, 2017 Posted April 25, 2017 On 13.4.2017 at 6:34 PM, StuxNet said: So I've been tinkering with the new guys (NeoAir's) for a couple weeks now, after porting my setup/project from FriendlyArm to Armbian kernel. Everything is going well, with the exception of getting AP Mode to work. (Forget about auto swap AP/Client) I'm sure it's user error on my part. I'm pretty technically inclined in the grand scheme of things, just not the fundamentals of hostapd, dnsmasq, interface configs on Linux. I'm a script kiddy where these are concerned, and `nmtui` comes in handy Anyways, I've gotten as far as getting the NeoAir to broadcast as an Access Point, however when I go to connect (on phone/laptop) it doesn't accept the correct password, or establish a connection even when there is no password. It's my understanding that this is an issue with DHCP/DNSMasq not signing a lease (or whatever the proper lingo is) with another WiFi enabled device. So clearly, something is wrong with my DNSmasq/DHCP configs. I've tried using DNSmasq, isc-dhcp-server and my tech buddy's gist for automating the hostapd/interfaces configs (albeit for a Nano Neo) which all pretty much end with the same results. An SSID that I can't connect to. Again, yes in this regard I'm a script kiddy and if it seems like I'm just taking shots in the dark, it's because I am At any rate, if you'd like me to post configs, I can. I was just hoping that you (FergusL) could post copies of your interfaces, hostapd, etc... so I can have a working setup. Then I could incorporate those (proper, working) configs into my buddies script. So then you, me and anyone else on this forum could run it, have all the proper configs setup (prompt for SSID/password?) and be good to go. Pass along the script kiddie torch Hello Armbian community! First time poster here As everyone in this thread, I have a Nanopi NEO Air and I recently switched from the (kinda horrible) FriendlyArm Linux to the beautiful Armbian. Yet one thing in the FriendlyArm Linux was kinda great: the ` turn-wifi-into-apmode yes/no` script. Something like this is missing in the Armbian unfortunately. I tried out the scripts FergusL posted here, and I also encountered several problems: 1. /var/run/NetworkManager/dnsmasq.pid and /run/dnsmasq.br0.pid seem to be missing in my version for some reason 2. the hostapd.conf was missing, so I've stolen the file from the FriendlyArm distro, assuming it should be the same 3. Like StuxNet, I can see the access point but cannot connect to it. Your help would be amazingly appreciated PS: Here's my hostapd.conf hw_mode=g channel=1 driver=nl80211 ssid=nanopi-wifiap interface=wlan0 # possible MAC address restriction #macaddr_acl=0 #accept_mac_file=/etc/hostapd.accept #deny_mac_file=/etc/hostapd.deny #ieee8021x=1 # Use 802.1X authentication # encryption wpa=2 wpa_passphrase=123456789 wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP CCMP rsn_pairwise=CCMP ctrl_interface=/var/run/hostapd # Only root can configure hostapd ctrl_interface_group=0
Igor Posted April 25, 2017 Posted April 25, 2017 1 hour ago, LRiedel said: the ` turn-wifi-into-apmode yes/no` script Some sort of config is under development / testing and is coming to your board with next major update or if you switch to daily builds ... p.s. Welcome
LRiedel Posted April 25, 2017 Posted April 25, 2017 5 minutes ago, Igor said: Some sort of config is under development / testing and is coming to your board with next major update or if you switch to daily builds ... p.s. Welcome That sounds pretty great! Since I'm pretty much a self taught linux newbie (obviously), I was wondering how to "switch to daily builds". Could you elaborate on that? (pretty much off topic, isn't it?) And when do you think you would manage to finish such a script? We kinda have a whole project going that strongly depends on the access point functionality. Again, thank you guys for the already awesome support (especially compared to the FriendlyArm folks). BTW, I tried out the "HOTSPOT" option in the armbian-config, with same results. Well, actually, much worse results, since it kinda breaks the normal WiFi-connection mode, so after using the HOSTSPOT option I can't connect/see any other WiFi networks.
Igor Posted April 25, 2017 Posted April 25, 2017 The config doesn't do any miracles in term of low level wireless support / AP mode. It only makes it easy to configure for newbies and lazy people But this problem here it would be fixed by our config - but it might not work very well yet ... if you are using legacy kernel, than wifi module must be loaded with op_mode=2 parameter, by creating a file: https://github.com/igorpecovnik/Debian-micro-home-server/blob/dev/debian-config#L49 and reboot is also an (proper) option.
LRiedel Posted April 25, 2017 Posted April 25, 2017 Just FYI, I just switched to daily build, et voilá, there now is a new /etc/hostapd.conf file. So I tried the armbian-config HOTSPOT option again, again with the same results, i.e. the whole wifi functional dying on me. Pretty neat that I always can restore the whole system from an SD card. A couple of questions still: 1. Are the Debian-micro-home-server tools also going to fully support the Ubuntu version? 2. I started it ("softie", right?) and there's no ACCESS POINT option to be found there. Am I missing something? PS: Sorry for nagging, I just really want Armbian to work, because the FriedlyArm Linux is totally not an option
Igor Posted April 25, 2017 Posted April 25, 2017 If you are using our tools, than hostapd config file is started from defaults ... which are usually fine for most cases. 1. Config and softly is distribution independent. It only has to be Debian derivate ... in theory. We do testings on both, Debian Jessie and Ubuntu Xenial anything else might work or not. 2. AP can be configured from armbian-config (debian-config) only or manual. Softy is for installing additional software, also accessible from config. I will try to reproduce to see what problems do you face here ... which version do you use? Debian or Ubuntu and I assume kernel 3.4 ?
Igor Posted April 25, 2017 Posted April 25, 2017 Now I see. You want to have wireless connection and access point at the same time ... I not sure if this chip / driver is capable of doing this? Even if it is, we don't support such scenario in our wizard.
LRiedel Posted April 25, 2017 Posted April 25, 2017 16 minutes ago, Igor said: If you are using our tools, than hostapd config file is started from defaults ... which are usually fine for most cases. 1. Config and softly is distribution independent. It only has to be Debian derivate ... in theory. We do testings on both, Debian Jessie and Ubuntu Xenial anything else might work or not. 2. AP can be configured from armbian-config (debian-config) only or manual. Softy is for installing additional software, also accessible from config. I will try to reproduce to see what problems do you face here ... which version do you use? Debian or Ubuntu and I assume kernel 3.4 ? No no, i want to use either the wireless connection or the access point, i.e. be able to switch between them. As I said, the AP configuration from armbian-config didn't work, I can see the network, the password is accepted too, but it just keeps connecting forever. Linux nanopiair 3.4.113-sun8i #4 SMP PREEMPT Tue Apr 25 02:57:36 CEST 2017 armv7l armv7l armv7l GNU/Linux
Igor Posted April 25, 2017 Posted April 25, 2017 1 minute ago, LRiedel said: As I said, the AP configuration from armbian-config didn't work, I can see the network, the password is accepted too, but it just keeps connecting forever. This means your network configuration is wrong. You must either make a bridge or setup a DHCP server .... our armbian-config tool should do this, but it's WIP / buggy / unreleased and can't be blame for troubles Check and properly setup /etc/network/interfaces
LRiedel Posted April 25, 2017 Posted April 25, 2017 2 minutes ago, Igor said: This means your network configuration is wrong. You must either make a bridge or setup a DHCP server .... our armbian-config tool should do this, but it's WIP / buggy / unreleased and can't be blame for troubles Check and properly setup /etc/network/interfaces Ah, ok, I guess I would have to do the manual setup then, since the bridged option didn't work either (I mostly tried the NAT option before). Also - as far as I understand - it should be used when I'm simultaneously connected to another network over ethernet, which is not the case. There's a bunch of different interfaces.* files. Which one am i supposed to edit? root@nanopiair:/etc/network# ll total 68 drwxr-xr-x 7 root root 4096 Apr 25 12:33 ./ drwxr-xr-x 97 root root 4096 Apr 25 12:33 ../ drwxr-xr-x 2 root root 4096 Apr 20 13:01 if-down.d/ drwxr-xr-x 2 root root 4096 Apr 25 11:17 if-post-down.d/ drwxr-xr-x 2 root root 4096 Apr 25 11:17 if-pre-up.d/ drwxr-xr-x 2 root root 4096 Apr 20 13:04 if-up.d/ -rw-r--r-- 1 root root 992 Apr 25 12:45 interfaces -rw-r--r-- 1 root root 525 Apr 25 02:24 interfaces.bonding drwxr-xr-x 2 root root 4096 Jan 24 2016 interfaces.d/ -rw-r--r-- 1 root root 992 Apr 25 12:28 interfaces.debian-config.backup -rw-r--r-- 1 root root 992 Apr 25 02:24 interfaces.default -rw-r--r-- 1 root root 197 Apr 25 02:24 interfaces.hostapd -rw-r--r-- 1 root root 182 Apr 25 02:24 interfaces.network-manager -rw-r--r-- 1 root root 173 Apr 25 12:33 interfaces.out.tmp -rw-r--r-- 1 root root 495 Apr 25 02:24 interfaces.r1 -rw-r--r-- 1 root root 610 Apr 25 02:24 interfaces.r1router -rw-r--r-- 1 root root 359 Apr 25 02:24 interfaces.r1switch
LRiedel Posted April 25, 2017 Posted April 25, 2017 22 minutes ago, Igor said: There is only one: interfaces, others are examples. OK, cool, so does this make sense then? I'd really hate to screwing it up and having to flash the system again # Wired adapter #1 allow-hotplug eth0 no-auto-down eth0 iface eth0 inet dhcp #address 192.168.0.100 #netmask 255.255.255.0 #gateway 192.168.0.1 #dns-nameservers 8.8.8.8 8.8.4.4 # hwaddress ether # if you want to set MAC manually # pre-up /sbin/ifconfig eth0 mtu 3838 # setting MTU for DHCP, static just: mtu 3838 # Wireless adapter #1 # Armbian ships with network-manager installed by default. To save you time # and hassles consider using 'sudo nmtui' instead of configuring Wi-Fi settings # manually. The below lines are only meant as an example how configuration could # be done in an anachronistic way: # allow-hotplug wlan0 iface wlan0 inet dhcp address 192.168.0.100 netmask 255.255.255.0 gateway 192.168.0.1 dns-nameservers 8.8.8.8 8.8.4.4 # wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf #wireless-mode Managed #wireless-power off # Local loopback auto lo iface lo inet loopback I basically uncommented the whole DHCP stuff... There's also interfaces.hostapd, which looks like this: auto lo br0 iface lo inet loopback auto eth0 iface eth0 inet manual auto wlan0 iface wlan0 inet manual iface br0 inet dhcp bridge_ports eth0 wlan0 #hwaddress ether # will be added at first boot It seems to me that this is the file which is used by armbian-config for the HOTSPOT option. So could it be that instead of "iface wlan0 inet manual" I should set this line to "iface wlan0 inet dhcp" and add the parameters like in the "interfaces" file?
Mavvas Posted May 17, 2017 Posted May 17, 2017 So I have a NanoPi Neo Air and I wanted to make an Access Point out of it using Hostapd and Dnsmasq. I tried using armbian but I have the AP6212A Wifi Chip so I can't use armbian as it just doesn't detect that wlan0 even exists. And based on googling I'm not even sure if that issue is resolved. If anyone can tell me how to resolve this issue with Armbian I will gladly switch over). So I switched over to the FriendlyArm distribution and it detects the wlan0 module successfully and I am able to connect to the internet. I even got Hostapd and Dnsmasq running but the Hostapd isn't broadcasting the AP (or at least it isn't being picked up by anything) even though the service seems to have run successfully except: "hostap Failed to set TX queue parameters for queue 0". Does anyone know if I have to do something special to get the AP6212A into accesspoint mode using FriendlyArm? TL;DR: Does anyone know if I have to do something special to get the AP6212A into accesspoint mode using FriendlyArm distribution? Or does anyone know how to get AP6212A wifi chip working on the mainline Armbian distribution?
Igor Posted May 18, 2017 Posted May 18, 2017 If you are trying to use mainline kernel on 6212A, than you need to apply this workaround: https://github.com/armbian/build/commit/71c466cba7f3a1fb3221f154c8e86ff781a4a565#diff-7563a343fbfc02b76915df346c297ba1R178 IIRC on legacy kernel it should work out of the box.
StuxNet Posted July 27, 2017 Posted July 27, 2017 On 5/17/2017 at 4:27 PM, Mavvas said: TL;DR: Does anyone know if I have to do something special to get the AP6212A into accesspoint mode using FriendlyArm distribution? Or does anyone know how to get AP6212A wifi chip working on the mainline Armbian distribution? Lil late to the party but, AP Mode under FriendlyArm distro is simple... Run: turn-wifi-into-apmode yes I've yet to get it working under Armbian to date of this post but I also am just not reading about Igor's 'workaround' posted above. To Armbian's credit Access Point mode does work, it just doesn't allow (lease) connections to devices. Someone with better understanding of TCP/IP under linux might be able to solve that problem. Until then, when I know. You'll know.
Igor Posted July 27, 2017 Posted July 27, 2017 Just now, StuxNet said: it just doesn't allow (lease) connections to devices. ... because module (in legacy kernel) must be loaded with op_mode=2 or network is not set correctly. armbain-config should have those exceptions, but bugs are possible since it's first version
StuxNet Posted July 27, 2017 Posted July 27, 2017 8 hours ago, Igor said: ... because module (in legacy kernel) must be loaded with op_mode=2 or network is not set correctly. armbain-config should have those exceptions, but bugs are possible since it's first version Yup yup. This I know. Wasn't asking for help just trying to help out dude I quoted. I'm very familiar with op_mode=2. It's probably the third time you've told me xD (I understand you're just trying to make the info known) Also, I've tried manually modprobing it, custom configs, armbian-config with no luck. No pressure though. You've got more important things to worry about and I'm well aware armbian-config is in first versions and expect bugs. TL;DR: I gotchu. 1
digitalsuper8 Posted September 1, 2017 Posted September 1, 2017 I have a NanoPi Neo Air now working as wifi accesspoint, showing SSID and allowing me to connect. My first trials with the apmode.sh (thanks FergusL) gave me the same problem that most of you had: There was an SSID being broadcast but I simply couldn't connect. In my case I believe the problem was doing: rmmod dhd modprobe dhd op_mode=2 Because this brought down the wlan0 module and I found out that thereafter the wlan0 doesn't have an IP address anymore. This causes problems for dnsmasq and leads to dnsmasq not issueing ip-addresses to devices that connect to hostapd. So hostapd accepts the password but dnsmasq doesn't provide an IP address so you cannot connect.. So here's what I did: 1. I disabled NetworkManager once (that then makes that permanently disabled at boot up): /bin/systemctl stop NetworkManager /bin/systemctl disable NetworkManager 2. Because Armbian in my case started up hostapd and dnsmasq during boot I disabled those too. /bin/systemctl disable hostapd /bin/systemctl disable dnsmasq 3. I wrote a script that first brings down wlan0 (ifdown wlan0), then runs the ' rmmod dhd' and 'modprobe dhd op_mode=2' commands. After that it brings up wlan0 (ifup wlan0), so that it again gets an IP address (it uses the 'interfaces' file for that). Finally the script starts hostapd and dnsmasq: ifdown wlan0 rmmod dhd modprobe dhd op_mode=2 ifup wlan0 /bin/systemctl start hostapd /bin/systemctl start dnsmasq I created a service based on that script and enabled it with systemctl so that at each boot automatically the nanopi neo air is in wifi accesspoint mode and will broadcast SSID and allows connections. I need to look up the exact script and the service files and will post those. It worked for my set up, hope it helps. 1
StuxNet Posted September 1, 2017 Posted September 1, 2017 @digitalsuper8 I'll have to try this out soon. I've abandoned the project for quite awhile now but I always figured it was just missing something simple (like below) related to dnsmasq and not simply a matter of modprobe dhd op_mode=2 which kept coming up again and again /bin/systemctl disable hostapd /bin/systemctl disable dnsmasq Just to be clear you ran FergusL's script, then applied what you mention in your post? or vice-versa? Looking to get a little more detail into the step by step you've taken. Also, what version you running? I just went ahead and plugged in my NPNA and /bin/systemctl disable dnsmasq command errors with Failed to start dnsmasq.service: Unit dnsmasq.service failed to load: No such file or directory. Ima keep hacking away at it, if you have any pointers or step by step directions in the meantime, I'd appreciate it. Prolly just my current setup, since as mentioned the project was abandoned awhile back and I have no recollection of how much/lil I biffed my network settings and configs xD
digitalsuper8 Posted September 2, 2017 Posted September 2, 2017 I will do a step by step later as you requested. I did my comment from top of mind. on the command you give you may just need to sudo it? sudo /bin/systemctl disable dnsmasq
StuxNet Posted September 2, 2017 Posted September 2, 2017 Lol. Naw. I'm almost 100% of the time running as root and redundantly use sudo. I double checked before posting. That's not it, but reasonable assumption. Step by step would be really appreciated.
digitalsuper8 Posted September 2, 2017 Posted September 2, 2017 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
StuxNet Posted September 2, 2017 Posted September 2, 2017 Heck yea dude. I'll give it a try on a brand new imaged NPNA. Thanks for the script/service. That's what it is all about! As far as correct conf files for hostapd and dnsmasq, can I/would these be setup with NMTUI, then disable network manager after the fact? This might be a really dumb question but I have limited experience with the network stack in linux. Also, you've given more than enough info so you don't even have to answer that 'give a mouse a cookie' question. I'm sure I can figure it out regardless. Thanks again.
Igor Posted September 3, 2017 Posted September 3, 2017 If you want to run hostapd on a certain interface you don't need to disable NetworkManager but add interface or MAC address to unamanaged-devices list: https://github.com/armbian/config/blob/dev/debian-config-jobs#L205-L208
Recommended Posts