Configure wireless network settings
Digi Embedded Yocto is configured by default to use DHCP to get the wired and wireless IP addresses. While DHCP works well for most devices, you may need to set your IP addresses to be static.
The network settings can be directly configured in a running system from Linux, or you can configure Digi Embedded Yocto to use your preferred networking setup for the generated images:
Set network configuration in a running system
To configure wireless interface settings in a running system you must modify the /etc/network/interfaces file accordingly:
- Stop the interface to configure:
#> ifdown wlan0
- Edit /etc/network/interfaces:
- To configure a static IP, configure the interface as static and assign the values as follows:
- 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. Note that having more than one default gateway is not recommended.
- 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.
- To configure a dynamic IP, use the following configuration:
- To disable the interface, remove or comment the auto line:
- Configure the wpa-supplicant.
auto wlan0 iface wlan0 inet static address <WLAN0_STATIC_IP> netmask <WLAN0_STATIC_NETMASK> gateway <WLAN0_STATIC_GATEWAY> dns-nameservers <WLAN0_STATIC_DNS> wpa-driver nl80211 wpa-conf /etc/wpa_supplicant.conf
auto wlan0 iface wlan0 inet dhcp wpa-driver nl80211 wpa-conf /etc/wpa_supplicant.conf
#auto wlan0
The default wireless configuration file /etc/wpa_supplicant.conf lets the device connect to any open access point. To connect to a secure access point, edit /etc/wpa_supplicant.conf and configure the settings of your wireless network, such as the SSID of the access point, encryption, and authentication.
- Synchronize data on disk.
#> sync
- Restart the configured interface to use the new settings:
#> ifup wlan0
CAUTION! Digi Embedded Yocto default configuration includes soft AP mode by adding a wlan1 entry in the /etc/network/interfaces. See Access Point mode.
Set network configuration from DEY
You can change the default network settings from Digi Embedded Yocto at image creation time. You configure this in your project's conf/local.conf file:
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:
WLAN0_MODE = "static"
- Configure the static IPs.
- 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. Note that having more than one default gateway is not recommended.
- 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.
By default, when setting static IPs, Digi Embedded Yocto images are configured with the following static IPs:
WLAN0_STATIC_IP ?= "192.168.43.30"
To change these default values, use the following variables:
WLAN0_STATIC_IP = "<ip address>" WLAN0_STATIC_NETMASK = "<netmask>" WLAN0_STATIC_GATEWAY = "<gateway ip address>" WLAN0_STATIC_DNS = "<dns server ip address>"
Configure dynamic IP
To configure a dynamic IP, use the following configuration:
WLAN0_MODE = "dhcp"