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.

The network settings can be directly configured:

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/16
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:

  1. Configure the interface mode as static:
  2. ETHn_MODE = "static"

    The value of n may be 0 or 1, depending on which Ethernet interface you wish to configure.

  3. Configure the static IPs. By default, when setting static IPs, Digi Embedded Yocto images are configured with the following static IPs:
  4. ETH0_STATIC_IP ?= "192.168.42.30"
    ETH1_STATIC_IP ?= "192.168.44.30"
  5. To change these default values, use the following variables:
  6. 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.