Configure Ethernet network settings
Note This section contains Linux BSP documentation for kernel v4.1. Click here for v4.9 BSP documentation.
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.
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 up network configuration on a running system
To configure the wireless setting in a running system, you must modify the file /etc/NetworkManager/system-connections/nm.ethX, where X is the interface index that starts from 0.
nm.ethX
[connection] id=eth0 type=ethernet interface-name=eth0 [ipv4] method=auto [ipv6] method=ignore
You can also use the command line tool nmcli to edit the Ethernet interface configuration file:
# 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.route-metric 50 nmcli> save nmcli> quit
You may need to execute an up and down of the interface to use the new configuration:
# nmcli con down eth0 # nmcli con up eth0
Set network configuration from DEY
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.
PDF
