KerOS 6

Overview

Depending on your Wirnet™ gateway model, you will have the following interfaces to connect the equipment to a network:

The management of these interfaces is done by ConnMan, a network manager which:

🗲

Technology

Preferred technologies and interface priorities

Preferred technology

Several interfaces are available for each gateway, so there is a notion of priorities between them.

The default order of priorities for the preferred technology is ethernet, gadget, wifi, cellular, which means that the ethernet interface will be used in priority if available, then the WiFi and finally the cellular.

Note: The 'wifi' field value is set by default in ConnMan. It is simply ignored when the gateway model does not feature the WiFi interface. The same applies to the 'cellular' field value.

It is possible to change the priority between backhaul interfaces:

conf_priority

Using command line

ConnMan’s auto-connection and fallback are configured via the editable configuration file /etc/network/connman/main.conf. You can change the order depending on your preferences:

PreferredTechnologies = ethernet, gadget, wifi, cellular

Using playbook

The following playbook can be used to change the order of technologies at the end of the file:

   - name: configure backhaul priorities
     groups:
       - all

     tasks:
       - !external
         use: kconf
         params:
            connman:
               main:
                 preferred_techs: 
                   - ethernet
                   - gadget
                   - wifi
                   - cellular
모

Ethernet Configuration

DHCP, static IP and DNS settings

By default, the ethernet interface is configured in DHCP.

You may configure a static IP in your gateway and/or enable DNS resolution as in examples below:

conf_ethernet

Using command line

ConnMan’s LAN configuration is done via an editable configuration file /etc/network/connman/lan.config. Note that this file is not created by default in the gateway. A configuration file /etc/network/connman/lan.config.example is provided.

Create your '.config' configuration file and reference the new IP address, netmask and default gateway:

IPv4 = 192.168.1.5/24/192.168.1.1

# The following syntax is also accepted : 
IPv4 = 192.168.1.5/255.255.255.0/192.168.1.1

Where 192.168.1.5 will be the new IP address of the Wirnet™ gateway, 24 will be the subnet length (in bits), and 192.168.1.1 will be the default gateway.

If DNS resolution is needed, the Nameservers field can also be added. Multiple addresses can be used. For example:

IPv4 = 192.168.1.5/24/192.168.1.1
Nameservers = 192.0.2.1,192.0.2.2

Using playbook

The following playbook can be used:

   - name: configure ethernet
     groups:
       - all

     tasks:
       - !external
         use: kconf
         params:
            connman:
               ethernet_services:
                 - name: eth0
                   ip_address: 192.168.1.5
                   netmask: "24"
                   gateway: 192.168.1.1
                   dns:
                     - 192.0.2.1
                     - 192.0.2.2
🛜

WiFi Configuration

SSID, passphrase and wireless services

The SSID and passphrase must be provided to the gateway to connect to a WiFi Access Point.

conf_wifi

Using command line

ConnMan’s WLAN configuration is done via an editable configuration file /etc/network/connman/wlan.config. This file is not created by default on the gateway. A configuration file /etc/network/connman/wlan.config.example is provided.

To manually configure a WiFi network, create the '.config' configuration file and adapt the values of the fields Name and Passphrase.

Connman supports multiple WiFi 'services' descriptions. Just add a new 'service' with another name than “service_WLAN”.
It also supports various types of configuration (static, tls, peap, …).

[global]
Name = WLAN
Description = WLAN Interface configuration
 
[service_WLAN]
Type = wifi
IPv4 = dhcp
Name = SSID_Name
Passphrase = 1234passphrase

[service_WLAN2]
Type = wifi
IPv4 = dhcp
Name = SSID_Name2
Passphrase = 5678passphrase

Using playbook

The following playbook can be used:

   - name: configure wifi
     groups:
       - all

     tasks:
       - !external
         use: kconf
         params:
            connman:
               wifi_services:
                 - name: WLAN
                   ssid: SSID_Name
                   passphrase: 1234passphrase
                 - name: WLAN2
                   ssid: SSID_Name2
                   passphrase: 5678passphrase
📶

Cellular Configuration

oFono, APN and SIM provisioning

oFono

The oFono service is used to configure the WAN modem, at startup or for reconfiguration purposes.

oFono also provides a D-Bus API to get and set the properties of the modem. It's mainly used to provision ConnMan and to abstract future modem modifications.

Configuration

oFono configuration is done via the editable configuration file /etc/network/ofono/provisioning.

It is used to define the APN, PIN code and cellular context:

  • A default APN for all SIM cards can be stored in this file. In this case, the MCC/MNC are not needed.
  • Multiple APN for multiple SIM cards can be stored (using MCC/MNC of the SIM).
  • A default PIN code for all SIM cards can be stored.
  • Multiple PIN codes for multiple SIM card can be stored (using SIM card ICCID).
  • Usually SIM cards only need SIM PIN code to be unlocked but sometimes other types of PIN code can be used, as described in the example below.
provisioning default file
# Syntax:
#
## Default "operator" configuration:
#[operator]
#internet.AccessPointName=<APN>              # Mandatory
#internet.Username=<username>
#internet.Password=<password>
#internet.AuthenticationMethod=<method>      # chap (default), pap, none
#internet.Protocol=<protocol>                # ip (default), ipv6, dual
#
## Specific "operator" configuration:
#[operator:<MCC>,<MNC>]
#internet.AccessPointName=<APN>              # Mandatory
#internet.Username=<username>
#internet.Password=<password>
#internet.AuthenticationMethod=<method>      # chap (default), pap, none
#internet.Protocol=<protocol>                # ip (default), ipv6, dual
#
## Default "sim" configuration:
#[sim]
#pin=<pin>                                   # SIM pin
#phone=<pin>                                 # PH-SIM pin
#firstphone=<pin>                            # PH-FSIM pin
#network=<pin>                               # PH-NET pin
#netsub=<pin>                                # PH-NETSUB pin
#service=<pin>                               # PH-SP pin
#corp=<pin>                                  # PH-CORP pin
#
## Specific "sim" configuration:
#[sim:<ICCID>]
#pin=<pin>                                   # SIM pin
#phone=<pin>                                 # PH-SIM pin
#firstphone=<pin>                            # PH-FSIM pin
#network=<pin>                               # PH-NET pin
#netsub=<pin>                                # PH-NETSUB pin
#service=<pin>                               # PH-SP pin
#corp=<pin>                                  # PH-CORP pin
 
# Default global APN for zcel platform
[operator]
internet.AccessPointName=bicsapn

conf_cellular

Using command line

Edit the file /etc/network/ofono/provisioning

[operator]
internet.AccessPointName=websfr

[sim]
pin=1234

It is also possible to configure several SIM cards. In this case, the MCC/MNC must be added in the configuration. If each SIM has a different PIN code, the ICCID of SIMs should also be added.

[operator:208,10]
internet.AccessPointName=websfr

[sim:41986345896489]
pin=1234

[operator:208,01]
internet.AccessPointName=orange

[sim:15649846135486]
pin=5678

Using playbook

The following playbook can be used:

   - name: configure default APN and PIN
     groups:
       - all

     tasks:
       - !external
         use: kconf
         params:
            ofono:
               default_pin: "1234"
               default_context:
                 apn: websfr

It is also possible to configure several SIM cards. In this case, the MCC/MNC must be added in the configuration. If each SIM has a different PIN code, the ICCID of SIMs should also be added.

   - name: configure several APNs and PINs
     groups:
       - all

     tasks:
       - !external
         use: kconf
         params:
            ofono:
               pins:
                 - iccid: "41986345896489"
                   pin: "1234"
                 - iccid: "15649846135486"
                   pin: "5678"
               contexts:
                 - mcc: "208"
                   mnc: "10"
                   apn: websfr
                 - mcc: "208"
                   mnc: "01"
                   apn: orange

Resetting oFono

The cellular configuration is handled by oFono. It needs to be reset in order to apply the configuration:

  1. Create the file "reset" in ofono directory: touch /etc/network/ofono/reset
  2. Restart ofono: systemctl restart ofono

Modem tools

A cellular diagnosis tool allows to detect most common problems on cellular modems. It also provides a quick overview of cellular modem status.

The script gsmdiag is available. It produces some informations on modem status.
The tool allows to redirect the output to a file.

Examples of diagnosis outputs:

SIM not detected
$ gsmdiag
Number of modems: 1
[Modem:/quectelqmi_0]
  Syspath:/sys/devices/soc0/soc/2100000.aips-bus/2184200.usb/ci_hdrc.1/usb2/2-1/2-1.1
  HardwarePosition:internal
  Powered:1
  Online:1
  Manufacturer:QUALCOMM INCORPORATED
  Model:QUECTEL Mobile Broadband Module
  Revision:EG25GGBR07A08M2G
  [SimProps]
    Present:0
  Error: no SIM in modem (double checked with AT commands)
SIM detected but not operational
$ gsmdiag
Number of modems: 1
[Modem:/quectelqmi_0]
  Syspath:/sys/devices/soc0/soc/2100000.aips-bus/2184200.usb/ci_hdrc.1/usb2/2-1/2-1.1
  HardwarePosition:internal
  Powered:1
  Online:1
  Manufacturer:QUALCOMM INCORPORATED
  Model:QUECTEL Mobile Broadband Module
  Revision:EG25GGBR07A08M2G
  [SimProps]
    Present:0
  Error: SIM detected (ICCID: 8959102062181454741F) but not usable by Ofono
Wrong pin code
$ gsmdiag
Number of modems: 1
[Modem:/sierra_0]
  Powered:1
  Online:0
  Manufacturer:Sierra Wireless, Incorporated
  Model:MC7304
  Revision:SWI9X15C_05.05.39.02 r22713 carmd-fwbuild1 2014/06/19 16:48:58
  [SimProps]
    Present:1
    CardIdentifier:89330120403002181830
    SubscriberIdentity: property does not exist
    LockedPins:dbus.Array([dbus.String(u'pin')], signature=dbus.Signature('s'), variant_level=1)
    PinRequired:pin
  Error: SIM code required (PIN, PUK, ...)
Wrong APN configured
$ gsmdiag
Number of modems: 1
[Modem:/quectelqmi_0]
  Powered:1
  Online:1
  Manufacturer:QUALCOMM INCORPORATED
  Model:QUECTEL Mobile Broadband Module
  Revision:EC25JFAR06A06M4G
  [SimProps]
    Present:1
    CardIdentifier:89330120403002181830
    SubscriberIdentity:208016202395143
    LockedPins:dbus.Array([dbus.String(u'pin')], signature=dbus.Signature('s'), variant_level=1)
    PinRequired:none
  [NetworkRegistrationProps]
    Status:registered
    MobileCountryCode:208
    MobileNetworkCode:010
    Name:SFR
    Strength: property does not exist
   Technology:lte
   RSSI:None
  [ConnectionContexts]
    [/quectelqmi_0/context1]
      Name:Internet
      Active:0
      Type:internet
      Protocol:ip
      AccessPointName:
      Username:
      Password:
      AuthenticationMethod:chap
     Error, no APN or wrong APN configured for this SIM card
Modem ready to connect
$ gsmdiag
Number of modems: 1
[Modem:/sierra_0]
  Powered:1
  Online:1
  Manufacturer:Sierra Wireless, Incorporated
  Model:MC7304
  Revision:SWI9X15C_05.05.39.02 r22713 carmd-fwbuild1 2014/06/19 16:48:58
  [SimProps]
    Present:1
    CardIdentifier:89330120403002181830
    SubscriberIdentity:208016202395143
    LockedPins:dbus.Array([dbus.String(u'pin')], signature=dbus.Signature('s'), variant_level=1)
    PinRequired:none
  [NetworkRegistrationProps]
    Status:registered
    MobileCountryCode:208
    MobileNetworkCode:01
    Name:Orange F
    Strength:40
  [ConnectionContexts]
    [/sierra_0/context1]
      Name:Internet
      Active:1
      Type:internet
      Protocol:ip
      AccessPointName:orange
      Username:
      Password:
      AuthenticationMethod:chap
🚨

Network Monitoring

Connectivity monitoring and recovery actions

Network monitoring

It consists in a script which monitors current network connectivity link.
The script relies on Connman to attempt to fix network connection when monitoring fails. Note that it is only able to monitor one single link at a time.
A configuration file is available in /etc/network/networkmonitoring.conf to adapt the behavior of the script.

High-level available configuration options are:

  • Enable/ Disable
  • Delay before first check
  • Interval between two monitorings when network is OK
  • Log level

It is enabled by default on our gateways, with default values.

Monitoring is either done by:

  • ICMP pings to a given server (IP address or DNS name)
  • TCP connection to a given server (IP address or DNS name) and port

Actions taken when monitoring fails are:

  • Restarting Connman service corresponding to network default route (if any)
  • Restarting Connman and Ofono daemons
  • Hardware reboot of all WAN modules and ethernet phy
  • Power cycle of external USB port to reboot USB dongle (since firmware v3.3)
  • Reboot board

Once monitoring fails, monitoring is done every 10 seconds. Actions are taken after a given amount of consecutive failed attempts to receive an answer from monitoring server.

Here is a commented example of configuration file:
[general]
# Monitor network. 0 means no monitoring. This is the default value.
monitor_network=1
# Number of seconds to wait before first check. Default: 60
first_check_delay=1200
# Interval in seconds between two monitoring when network is OK. Default: 1200
check_interval=120
# Log level:
#  - 0: No messages
#  - 1: Messages every time an action is taken
#  - 2: Messages every time monitoring fails
#  - 3: Messages every time monitoring is done
#  - 4 or more: Script debugging, many messages
# default is 0
log_level=3

[ping]
# Server used to check if network is up or not. It can be an Ip adress or a name. Default: 8.8.8.8
server=8.8.8.8
#server=google.com
# Protocol used to check if server is reachable. Possible values are :
# - ping: will send ICMP ping to given server. Port is useless
# - tcp: will try to connect to given server on given port
#Default is ping
protocol=ping
# Port on which ping is done. Default is 80.
port=80
# Timeout in seconds before saying we failed to connect to monitored server.
# Default is 5
timeout=5

[actions]
# Once network failure is detected, ping is done each 10s.
# Actions is taken after a number of consecutive failure.
# If parameter is 0, corresponding action will never be taken.
# Number of failed ping before reconnecting service (using connman command). Default is 3.
ping_error_before_service_reconnect=3
# Number of failed ping before restarting Ofono and Connman servers. Default is 5.
ping_error_before_servers_restart=20
# Number of failed ping before restarting Ofono and Connman servers and eth and modems hardware. Default is 10
ping_error_before_network_hardware_reboot=50
# Number of failed ping before restarting board. Default is 20
# If not 0, this parameter should be more than all previous action parameters
ping_error_before_board_reboot=100
# Number of failed ping before actions are retried. Default is 0 (not done)
ping_error_before_reset_to_first_action=0