Headless (really!) Wifi and SSH setup

I’ve recently bought myself a new toy single board computer. It’s the NanoPi Neo Air, a 40x40mm 1.2GHz quad-core linux board with 512MB RAM, on-board Wifi and Bluetooth radio and a whooping 32GB of eMMC storage!

nanopiNeoAir

I downloaded and installed the Armbian image in the microSD card using Etcher, an open-source, foolproof way of burning images without worrying about dd-stroying your hard drive.

This tiny board is fantastic for mobile robots due to its size, which is one of the reasons I picked it up – no wasted space on unused USB ports, HDMI connectors or Ethernet sockets. The only thing needed is a wifi connection to ssh into the board and we’re set!

A quick google search shows quite a few tutorials on how to setup wifi and ssh in a headless environment, but for some reason they all insist on plugging in a screen and keyboard, some even a mouse! – not exactly headless.

After looking around various forum posts I concluded that the way to go (or at least what got me in) is doing the following.

Connect the microSD card and navigate to /etc/wpa_supplicant/wpa_supplicant.conf or create it if it isn’t already there. This is were we configure the wifi network we want to connect to:

network={
ssid="Your wifi network"
psk="Password"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
}

Once the network is configured we have to change /etc/network/interfaces to read the network info from the previous file and to connect automatically:

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

This takes care of the network part. On some systems like the Raspberry SSH comes disabled by default. To enable it simply create an empty file called ssh on the root file system. This can be done with:

touch ssh

The last thing to do before connecting is finding the correct IP address, which we’ll do using nmap:

nmap -p22 –open -sV XXX.XXX.X.0/24

Where XXX.XXX.X.0 is the IP’s base address, for example 192.168.1.0

If the right address isn’t directly identifiable a simple way of doing so is unplugging the board and rerunning the command, the one that disappeared is the one assigned to the board!

1 thought on “Headless (really!) Wifi and SSH setup

  1. Michael Chambers Reply

    I find It’s much easier with DietPi, since it has .txt file you can adjust config before first initialization

Leave a Reply

Your email address will not be published. Required fields are marked *