DESK-MX8M-L/Deployment/How to configure the network interfaces

From DAVE Developer's Wiki
Jump to: navigation, search
History
Issue Date Notes

2022/01/14

First DESK-MX8M-L release

2023/02/24

First DESK-MX8M-L release
2026/04/20 DESK-MX-L-6.3.0 release


How to configure the network interfaces[edit | edit source]

For deploying an Embedded System, one of the most important configuration is the Network Interface configuration.

Once the Embedded Device is finally configured for stand-alone bootstrap, the network interface should be configured for reaching the device remotely via network connections like ssh, telnet, ftp, http, etc.

This Application Note briefly describes how it is possible to simply configure the network interfaces on systemd

Resources[edit | edit source]

For further details on network configuration, please refer - for example - to:

Examples[edit | edit source]

The following configuration assumptions are used in the paragraphs shown below:

  • IP address range of the LAN network 192.168.1.0 - 192.168.1.255
  • IP address of the gateway 192.168.1.254
  • IP address of the device 192.168.1.100

systemd[edit | edit source]

The network configuration for systemd are basically found in the /etc/systemd/network/ directory.

The most simply way for configuring the network interface is to create/edit the file /etc/systemd/network/20-eth0.network as per the following paragraphs. In the event that there are another network interface, then this must be create/edit as /etc/systemd/network/20-eth1.network. For more example and usage hints on systemd, please refer to our wiki page.

Static IP address[edit | edit source]

SBC ORCA has two network interfaces, while SBCX MINI has only one ethernet interface; in this latest case, just configure the eth0 interface.

Example for ethernet interface 0.

[Match]
Name=eth0

# Prevent the interface loading if the kernel boots from nfs
KernelCommandLine=!nfsroot

[Network]
Address=192.168.1.100/24
Gateway=192.168.1.254
DNS=192.168.1.1

Example for ethernet interface 1.

[Match]
Name=eth1

# Prevent the interface loading if the kernel boots from nfs
KernelCommandLine=!nfsroot

[Network]
Address=192.168.1.101/24
Gateway=192.168.1.254
DNS=192.168.1.1

Once modified, the networkd service should be resarted:

systemctl restart systemd-networkd

Dynamic IP addres (DHCP)[edit | edit source]

SBC ORCA has two network interfaces, while SBCX MINI has only one ethernet interface; in this latest case, just configure the eth0 interface.

The network interface is configured - using a proper DHCP server on the network - by using the DHCP key in the configuration file as follows:

[Match]
Name=eth0

# Prevent the interface loading if the kernel boots from nfs
KernelCommandLine=!nfsroot

[Network]
DHCP=yes

If there is another network interface, the configuration file is as follows:

[Match]
Name=eth1

# Prevent the interface loading if the kernel boots from nfs
KernelCommandLine=!nfsroot

[Network]
DHCP=yes

When systemd network starts, it tries to use a DHCP server present in the network to configure the interface.

U-Boot IP settings[edit | edit source]

Static IP address[edit | edit source]

Below is an example of configuring the ethernet interfaces with static IP parameters in U-Boot.

To configure eth0 with a static ip address, in U-Boot use the following example:

u-boot=> setenv serverip 192.168.1.167
u-boot=> setenv ipaddr 192.168.1.165
u-boot=> setenv gatewayip 192.168.1.254
u-boot=> setenv netmask 255.255.255.0
u-boot=> setenv netdev eth0
u-boot=> setenv addip 'setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}::${netdev}:off'
u-boot=> run mmc_loadk mmc_loadfdt mmcargs addip addcons addmisc;  booti ${loadaddr} - ${fdtaddr}
DHCP address[edit | edit source]

To configure eth0 in DHCP mode, in U-Boot use the following commands

u-boot=> setenv addip 'setenv bootargs ${bootargs} ip=:::::eth0:dhcp'
u-boot=> run mmc_loadk mmc_loadfdt mmcargs addip addcons addmisc;  booti ${loadaddr} - ${fdtaddr}
systemd[edit | edit source]

SBC ORCA has two network interfaces, while SBCX MINI has only one ethernet interface; in this latest case, just configure the eth0 interface on Linux systemd

Example for ethernet interface 0.

[Match]
Name=eth0

# Prevent the interface loading if the kernel boots from nfs
KernelCommandLine=!nfsroot
KernelCommandLine=!ip

[Network]
Address=192.168.1.100/24
Gateway=192.168.1.254
DNS=192.168.1.1

Example for ethernet interface 1.

[Match]
Name=eth1

# Prevent the interface loading if the kernel boots from nfs
KernelCommandLine=!nfsroot
KernelCommandLine=!ip

[Network]
Address=192.168.1.101/24
Gateway=192.168.1.254
DNS=192.168.1.1

Once modified, the networkd service should be resarted:

systemctl restart systemd-networkd

DNS[edit | edit source]

The DNS key (in the configuration file) is used only if the systemd-resolved service is enabled and the /etc/resolv.conf has a symbolic link to /run/systemd/resolve/stub-resolv.conf

ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf

Once modified, the resolved service should be resarted:

systemctl restart systemd-resolved

loopback network interface[edit | edit source]

systemd contains native implementations of various tasks that need to be executed as part of the boot process.

For example, it sets the hostname or configures the loopback network device.

Apply configuration changes[edit | edit source]

After editing the above files, changes are applied after reboot or by restarting systemd-networkd.service:

root@desk-mx8mp:~# systemctl restart systemd-networkd.service