Set NetworkManager configuration
You can use NetworkManager.conf, the configuration file for NetworkManager, to set up NetworkManager behavior. The default file location is /etc/NetworkManager/NetworkManager.conf.
The general NetworkManager configuration and the connection profiles setup can be established:
-
At runtime by modifying the NetworkManager.conf file in the root file system of your device and then restarting NetworkManager.
-
At build time by appending your own configuration files to the NetworkManager package. The meta-digi layer already contains a bbappend for NetworkManager that includes the default NetworkManager.conf (meta-digi/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager_%.bbappend)
See NetworkManager.conf(5) for more information on the configuration file. |
To create images that include your own configuration file, follow these steps:
-
Write the configuration file NetworkManager.conf.
-
Locate it in your layer inside the directory recipes-connectivity/networkmanager/networkmanager.
-
Create a networkmanager_%.bbappend file inside the recipes-connectivity/networkmanager directory to extend the existing recipe file with new files.
networkmanager_%.bbappend fileFILESEXTRAPATHS_prepend := "${THISDIR}/${BP}:"
-
Build your Digi Embedded Yocto project as usual.
Configure Ethernet network settings
NetworkManager manages the Ethernet interfaces in Digi Embedded Yocto. By default, Digi Embedded Yocto includes an Ethernet configuration placeholder under /etc/NetworkManager/system-connections/nm.ethX, where X is the Ethernet interface index starting at zero. With this configuration file, NetworkManager will try to bring up any previously detected Ethernet interface.
By default, Digi Embedded Yocto builds images configured to use DHCP to get the wired IP addresses. While DHCP works well for most devices, you may need to set your IP addresses to be static.
Set up network configuration on a running system
You can change the Ethernet settings on the target using command line tool nmcli.
Configure static IPs
To configure the static IP for the Ethernet interface you can use this nmcli command:
~# nmcli con edit eth0 ===| nmcli interactive connection editor |=== Editing existing '802-3-ethernet' connection: 'eth0' Type 'help' or '?' for available commands. Type 'describe [<setting>.<prop>]' for detailed property description. You may edit the following settings: connection, 802-3-ethernet (ethernet), 802-1x, ipv4, ipv6, dcb nmcli> set ipv4.method manual nmcli> set ipv4.address 192.168.104.87/24 nmcli> set ipv4.gateway 192.168.104.10 nmcli> set ipv4.dns 8.8.8.8 nmcli> save Connection 'eth0' (7296aec4-0cf2-3172-a2a8-79bb745d5a9a) successfully updated. nmcli> quit
Now restart the Ethernet interface to make sure it will use the new configuration.
# nmcli con up eth0
Configure dynamic IP
To configure a dynamic IP, use the following nmcli command on your target.
~# nmcli con edit eth0 ===| nmcli interactive connection editor |=== Editing existing '802-3-ethernet' connection: 'eth0' Type 'help' or '?' for available commands. Type 'describe [<setting>.<prop>]' for detailed property description. You may edit the following settings: connection, 802-3-ethernet (ethernet), 802-1x, ipv4, ipv6, dcb nmcli> set ipv4.method auto nmcli> set ipv4.dns Enter 'dns' value: nmcli> set ipv4.gateway Enter 'gateway' value: nmcli> save Connection 'eth0' (7296aec4-0cf2-3172-a2a8-79bb745d5a9a) successfully updated. nmcli> quit
Restart the Ethernet interface to make sure it will use the new configuration.
~# nmcli con up eth0
Set network configuration from Digi Embedded Yocto
You can change the default network settings from Digi Embedded Yocto at image-creation time. See Set NetworkManager configuration.
Configure static IPs
To configure static IPs, you can use the following configuration in your conf/local.conf file:
-
Configure the interface mode as static:
ETHn_MODE = "static"
The value of n may be 0 or 1, depending on which Ethernet interface you wish to configure.
-
Configure the static IPs. By default, when setting static IPs, Digi Embedded Yocto images are configured with the following static IPs:
ETH0_STATIC_IP ?= "192.168.42.30" ETH1_STATIC_IP ?= "192.168.44.30"
-
To change these default values, use the following variables:
ETHn_STATIC_IP = "<ip address>" ETHn_STATIC_NETMASK = "<netmask>" ETHn_STATIC_GATEWAY = "<gateway ip address>" ETHn_STATIC_DNS = "<dns server ip address>"
-
n may be 0 or 1 depending on the Ethernet interface you want to configure.
-
ETHn_STATIC_IP is the static IP address for the specified Ethernet interface.
-
ETHn_STATIC_NETMASK is the netmask address for the specified Ethernet interface.
-
ETHn_STATIC_GATEWAY is the default gateway address. Note that having more than one default gateway is not recommended.
-
ETHn_STATIC_DNS is the name resolution server IP address. You can add several servers as a space-separated list. Note that if different interfaces define DNS entries, the target’s /etc/resolv.conf file uses the last-defined entry.
-
Configure dynamic IP
To configure a dynamic IP, use the following configuration:
ETHn_MODE = "dhcp"
The value of n is the number of the configured Ethernet interface.
Configure Wi-Fi settings
NetworkManager manages the Ethernet interfaces in Digi Embedded Yocto. By default, Digi Embedded Yocto includes a Wi-Fi configuration placeholder under /etc/NetworkManager/system-connections/nm.wlanX, where X is the Wi-Fi interface index starting at zero. With this configuration file, NetworkManager will try to bring up any previously detected Wi-Fi interface.
By default, Digi Embedded Yocto builds images configured to use DHCP to get the wireless IP addresses. While DHCP works well for most devices, you may need to set your IP addresses to be static.
Additionally, the following Wi-Fi modes are available to configure:
By default, Digi Embedded Yocto configures wlan0 with client infrastructure mode, leaving the rest of wlan virtual interfaces down. When using concurrent mode, the interface is shared between all functionalities so overall performance is affected.
Maximum performance is achieved on the physical wlan0 when the wireless interface is not shared between multiple functionalities. Digi recommends you always use the physical wlan0 interface and only configure virtual interfaces when using concurrent modes. |
Set up network configuration on a running system
To configure the wireless settings in a running system use nmcli command line tool.
Configure static IPs
To configure the static IP for the Wireless interface you can use this nmcli command:
~# nmcli con edit wlan0 ===| nmcli interactive connection editor |=== Editing existing '802-11-wireless' connection: 'wlan0' Type 'help' or '?' for available commands. Type 'describe [<setting>.<prop>]' for detailed property description. You may edit the following settings: connection, 802-11-wireless (wifi), 802-11-wireless-security (wifi-sec), 802-1x, ipv4, ipv6 nmcli> set wifi.ssid <AP_name> nmcli> set wifi-sec.key-mgmt <encryption_method> nmcli> set wifi-sec.psk <password> nmcli> set ipv4.method manual nmcli> set ipv4.address 192.168.104.87/24 nmcli> set ipv4.gateway 192.168.104.10 nmcli> set ipv4.dns 8.8.8.8 nmcli> save nmcli> quit
Restart the wireless interface to make sure it will use the new configuration.
# nmcli con up wlan0
Configure dynamic IP
To configure a dynamic IP, use the following nmcli command on your target.
~# nmcli con edit wlan0 ===| nmcli interactive connection editor |=== Editing existing '802-11-wireless' connection: 'wlan0' Type 'help' or '?' for available commands. Type 'describe [<setting>.<prop>]' for detailed property description. You may edit the following settings: connection, 802-11-wireless (wifi), 802-11-wireless-security (wifi-sec), 802-1x, ipv4, ipv6 nmcli> set wifi.ssid <AP_name> nmcli> set wifi-sec.key-mgmt <encryption_method> nmcli> set wifi-sec.psk <password> nmcli> set ipv4.method auto set ipv4.dns Enter 'dns' value: nmcli> set ipv4.gateway Enter 'gateway' value: nmcli> save nmcli> quit
Restart the wireless interface to make sure it will use the new configuration.
~# nmcli con up wlan0
Digi Embedded Yocto default configuration includes SoftAP mode by adding a wlan1 entry in the /etc/network/interfaces. See Access point mode. |
Set up network configuration from Digi Embedded Yocto
You can change the default network settings from Digi Embedded Yocto at image-creation time. See Set NetworkManager configuration.
Configure static IPs
To configure static IPs, use the following configuration in your project’s conf/local.conf file:
-
Configure the interface mode as static:
WLAN0_MODE = "static"
-
Configure the static IP settings:
WLAN0_STATIC_IP = "<ip address>" WLAN0_STATIC_NETMASK = "<netmask>" WLAN0_STATIC_GATEWAY = "<gateway ip address>" WLAN0_STATIC_DNS = "<dns server ip address>"
where
-
WLAN0_STATIC_IP is the static IP address for wlan0 interface.
-
WLAN0_STATIC_NETMASK is the netmask address for wlan0 interface.
-
WLAN0_STATIC_GATEWAY is the default gateway address.
-
WLAN0_STATIC_DNS is the name resolution server IP address. You can add several servers as a space-separated list. Note that if different interfaces define DNS entries, the target’s /etc/resolv.conf file uses the last entry defined.
-
Configure dynamic IP
To configure a dynamic IP, use the following configuration in your project’s conf/local.conf file:
WLAN0_MODE = "dhcp"
Configure cellular network settings
NetworkManager manages the cellular devices in Digi Embedded Yocto. By default, Digi Embedded Yocto includes a cellular configuration placeholder under /etc/NetworkManager/system-connections/nm.cellular. With this configuration file, NetworkManager will try to bring up any previously detected cellular device.
NetworkManager uses ModemManager support to access each identified modem.
Set up cellular connection using NetworkManager
You can also change the configuration on the target using the nmcli tool.
For example to configure the APN value of the cellular interface:
~# nmcli con edit cellular ===| nmcli interactive connection editor |=== Editing existing 'gsm' connection: 'cellular' Type 'help' or '?' for available commands. Type 'describe [<setting>.<prop>]' for detailed property description. You may edit the following settings: connection, gsm, serial, ppp, ipv4, ipv6 nmcli> set gsm.apn <apn_name> nmcli> save nmcli> quit
NetworkManager then uses the information in that file to establish a cellular connection when bringing up the network interface.
You may need to bring the interface up again to use the new configuration:
~# nmcli con up cellular
Verify Digi XBee Cellular connectivity
To verify that the Digi XBee Cellular works as a modem, follow these steps:
-
Insert an unlocked SIM card into the XBee Cellular modem.
-
Unplug the power supply.
-
Plug the XBee Cellular into the ConnectCore 8M Mini Development Kit on its socket.
-
Plug the power supply into the power barrel connector of the ConnectCore 8M Mini Development Kit.
-
After the boot process, the system recognizes the XBee Cellular modem and creates several USB node devices.
~# ls -la /dev/ttyUSB* crw-rw---- 1 root dialout 188, 0 Oct 6 15:01 /dev/ttyUSB0 crw-rw---- 1 root dialout 188, 1 Oct 6 15:01 /dev/ttyUSB1
-
Configure the PDP context 3 of the modem. To do so:
-
Open the Serial port to communicate with the cellular modem.
~# microcom -s 115200 /dev/ttyUSB1
You can verify communication by sending an AT command such as "AT". The system returns an "OK" when it identifies the AT node.
~# microcom -s 115200 /dev/ttyUSB1 OK
-
To enable command echoing, type the command "ATE1" on the serial console.
-
Type the following AT command in the Console log box:
AT+CGDCONT=3,"IP","<APN>"
where <APN> is the desired APN.
For help determining which APN you are using, see the Digi XBee Cellular Embedded Modem User Guide.
To verify that the change has been applied, issue the following AT command:
AT+CGDCONT?
-
See the XBee Cellular and XCTU documentation for more information.
Set network configuration from Digi Embedded Yocto
You can use the following variables in your Digi Embedded Yocto project’s conf/local.conf to configure your cellular interface and network provider:
-
CELLULAR_APN: Access Point Name (APN) as defined by your cellular provider.
-
CELLULAR_USER: Username for authentication.
-
CELLULAR_PASSWORD: Password for authentication.
-
CELLULAR_PIN: SIM card pin number. Do not define if the SIM card is not locked.
These authentication settings are optional depending on the cellular network and SIM used. See the Mobile Broadband Information web page.
CELLULAR_APN = "vzwinternet"
When building images, Digi Embedded Yocto will add those fields to the NetworkManager configuration file (/etc/NetworkManager/system-connections/nm.cellular), within the generated image. For the example above, the following file will be generated:
[connection]
id=cellular
type=gsm
[gsm]
apn=vzwinternet
number=*99#
[ppp]
lcp-echo-failure=3
lcp-echo-interval=5
[ipv4]
method=auto
[ipv6]
method=auto
See Set NetworkManager configuration for information on how to configure the behavior of NetworkManager.
Instructions for unsupported modems
If Digi Embedded Yocto does not support your modem, Digi can provide a Cellular Integration Guide to help you integrate a modem into your Digi Embedded Yocto system. Contact your local Digi representative or Digi Technical Support to obtain the guide.