Skip to content
Matt Magoffin edited this page Jun 28, 2018 · 2 revisions

Debian 8+ SolarNode based networking

Networking is managed by systemd-networkd.

WiFi configuration

To support WiFi connections the /etc/wpa_supplicant/wpa_supplicant-wlan0.conf file must be configured with the SSID to connect to and the password to connect with. An example file looks like this:

country=nz
network={
    ssid="ssid"

    # for plain-text passphrase, enclose in quotes
    #psk="not very secret"

    # better to use wpa_passphrase however, and then omit quotes
    psk=2b1d17284c5410ee5eaae7151290e9744af2182b0eb8af20dd4ebb415928f726

    # if the SSID is hidden, add
    #scan_ssid=1
}

Note that the psk value should be hashed via the wpa_passphrase program, or else to use a plain-text password enclose the value in double quotes.

Then the wpa_supplicant@wlan0 service must be enabled and started:

systemctl enable wpa_supplicant\@wlan0
systemctl start wpa_supplicant\@wlan0

Raspberry Pi /boot/wpa_supplicant.conf config

On the Raspberry Pi, SolarNode will look for a /boot/wpa_supplicant.conf file when the system starts, and if found copy that to the right place.

Static IP address

By default SolarNode relies on a DHCP server to supply it with a dynamic IP address. To configure a static IP address, edit the /etc/systemd/network/eth.network file (or /etc/systemd/network/wlan.network for WiFi) and configure it along these lines:

[Network]
DNS=10.1.10.1
DNS=12.34.56.79

[Address]
Address=10.1.10.9/24

[Route]
Gateway=10.1.10.1

Network ping plugin support

To support the Network Ping Control plugin, the solar user can be granted permission to restart networking on connectivity issues. This can be useful on unreliable networks (WiFi, cellular, etc.).

Using sudo, create a /etc/sudoers.d/solarnode file with:

solar ALL = (root) NOPASSWD: /bin/systemctl status systemd-networkd, \
	/bin/systemctl restart systemd-networkd

This will allow the solar user to run systemctl with either the status or restart actions on the systemd-networkd service, like this:

sudo systemctl status systemd-networkd

Then the HTTP Ping component can be configured, for example, with a Command toggle off value of sudo /bin/systemctl restart systemd-networkd and optionally a Command toggle on value of sudo /bin/systemctl status systemd-networkd to have the output logged.

Clone this wiki locally