Open main menu

DAVE Developer's Wiki β

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

< DESK-MX6UL-L
Revision as of 16:23, 16 March 2022 by U0007 (talk | contribs) (Static IP address)

History
Version Issue Date Notes
1.0.0 Oct 2020 New documentation layout



Contents

How to configure the network interfacesEdit

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

ResourcesEdit

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

ExamplesEdit

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

systemdEdit

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.

For more example and usage hints on systemd, please refer to our wiki page.

Static IP addressEdit

[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

Dynamic IP addres (DHCP)Edit

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

[Match]
Name=eth0

# 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.

DNSEdit

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

loopback network interfaceEdit

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 changesEdit

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

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