Configure Networks

Configure the network interfaces for a balenaCloud device

The configuration of the network interfaces of a MobiusFlow® balenaCloud device is handled by the manage microservice. All configuration is stored in a JSON file which can be updated by plugging in a properly configured USB memory stick or through the balenaCloud device terminal.

Network Configuration File Structure

As each device type has different configurations and names for the underlying network interfaces, the structure of the network configuration may differ depending on the device type you are using

[
  {
    "connection": {
      "enabled": true,
      "type": "ethernet",
      "id": "Wired connection 1",
      "interface-name": "enp2s0"
    },
    "ipv4": {
      "method": "auto",
      "address": "",
      "prefix": 24,
      "gateway": "",
      "dns": ""
    }
  },
  {
    "connection": {
      "enabled": true,
      "type": "ethernet",
      "id": "Wired connection 2",
      "interface-name": "enp3s0"
    },
    "ipv4": {
      "method": "manual",
      "address": "192.168.1.100",
      "prefix": 24,
      "gateway": "",
      "dns": ""
    }
  },
  {
    "connection": {
      "enabled": false,
      "type": "wifi",
      "id": "WiFi connection 1",
      "interface-name": "wlp4s0"
    },
    "ipv4": {
      "method": "auto",
      "address": "",
      "prefix": 24,
      "gateway": "",
      "dns": ""
    },
    "wifi": {
      "ssid": ""
    },
    "wifi-security": {
      "psk": "",
      "auth-alg": "open",
      "key-mgmt": "wpa-psk"
    }
  },
  {
    "connection": {
      "enabled": false,
      "type": "hotspot",
      "id": "WiFi hotspot 1",
      "interface-name": "wlp4s0"
    },
    "wifi": {
      "ssid": "",
      "channel": 6
    },
    "wifi-security": {
      "psk": "",
      "key-mgmt": "wpa-psk"
    }
  },
  {
    "connection": {
      "enabled": true,
      "type": "gsm",
      "id": "GSM connection 1",
      "interface-name": "cdc-wdm0"
    },
    "gsm": {
      "apn": "arkessa.com",
      "username": "arkessa",
      "password": "arkessa"
    }
  }
]

Editing the Network Configuration

Using the balenaCloud Device Terminal

Navigate to your balenaCloud dashboard and login in

Navigate to the Device Summary page of the device you want to configure

Open a terminal in the manage microservice

Change to the /data/.mobius/manage directory and edit the networks.json file by running the following commands:

cd /data/.mobius/manage
vi networks.json

This will open the network configuration file for editing using the vi editor

Make any required changes and save the file

Exit the terminal and restart the manage microservice by clicking on the restart icon next to the manage service

Be careful when changing the network interface you are using to connect the device to the internet as you could prevent the device from connecting to balenaCloud.

Using a USB Memory Stick

Using a USB memory stick to update the network interfaces is useful when none of the network interfaces is configured to connect to the internet so it is not possible to use the balenaCloud device terminal. You will obviously need physical access to the device to use this method.

Format the USB memory stick as FAT32

Rename the USB memory to MOBIUSCONF

Create a file on the USB memory stick called networks.json

Open the file on your laptop or PC in your favourite text editor and paste in the correct JSON configuration from the examples above

Make any required changes

Save the file and unplug the USB memory stick from your laptop or PC

Plug the USB memory stick into any of the USB ports on your device

Reboot your device

When the device reboots it will copy the networks.json onto the device and use the new configuration for its network interfaces (this will take a minute or two)

You can then remove the USB memory stick and your device will continue to use the new network configuration.

Last updated