Difference between revisions of "DESK-MX8M-L/Deployment/How to configure the network interfaces"

From DAVE Developer's Wiki
Jump to: navigation, search
 
(2 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
!colspan="4" style="width:100%; text-align:left"; border-bottom:solid 2px #ededed"|History
 
!colspan="4" style="width:100%; text-align:left"; border-bottom:solid 2px #ededed"|History
 
|-  
 
|-  
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Version
 
 
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Issue Date
 
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Issue Date
 
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Notes
 
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Notes
 
|-
 
|-
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|1.0.0
+
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|{{oldid|15768|2022/01/14}}
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|Jan 2022
+
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|First DESK-MX8M-L release
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|First DESK-MX8M release
+
|-
 +
! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000" |2023/02/24
 +
! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000" |DESK-MX8M-L-2.0.0 release
 
|-
 
|-
 
|}
 
|}
Line 15: Line 16:
 
<section begin=Body/>
 
<section begin=Body/>
  
{{#lst:How_to_configure_the_network_interfaces | Body}}
+
== How to configure the network interfaces ==
 +
 
 +
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 [https://www.freedesktop.org/wiki/Software/systemd/ systemd]
 +
 
 +
=== Resources ===
 +
 
 +
For further details on network configuration, please refer - for example - to:
 +
 
 +
* [https://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_the_basic_network_configuration_with_ifupdown_legacy Debian - The basic network configuration]
 +
* [https://www.freedesktop.org/software/systemd/man/systemd.network.html systemd network configuration]
 +
 
 +
=== Examples===
 +
 
 +
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 ===
 +
 
 +
The network configuration for systemd are basically found in the <code>/etc/systemd/network/</code> 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 [[XELK-AN-008:_How_to_use_systemd_on_an_Embedded_system#Configuring_the_network_interfaces | wiki]] page.
 +
 
 +
==== Static IP address ====
 +
SBC ORCA has two network interfaces, below is shown how to configure them both through a static IP. In the case of SBCX MINI there is only one ethernet interface, consequently going to configure only eth0 interface.
 +
 
 +
Example for ethernet interface 0.
 +
<pre>
 +
[Match]
 +
Name=eth0
 +
 
 +
# Prevent the interface loading if the kernel boots from nfs
 +
KernelCommandLine=!nfsroot
 +
 
 +
[Network]
 +
Address=192.168.1.100
 +
Gateway=192.168.1.254
 +
DNS=192.168.1.1
 +
</pre>
 +
 
 +
Example for ethernet interface 1.
 +
<pre>
 +
[Match]
 +
Name=eth1
 +
 
 +
# Prevent the interface loading if the kernel boots from nfs
 +
KernelCommandLine=!nfsroot
 +
 
 +
[Network]
 +
Address=192.168.1.101
 +
Gateway=192.168.1.254
 +
DNS=192.168.1.1
 +
</pre>
 +
 
 +
Once modified, the <code>networkd</code> service should be resarted:
 +
 
 +
systemctl restart systemd-networkd
 +
 
 +
==== Dynamic IP addres (DHCP) ====
 +
 
 +
SBC ORCA has two network interfaces, below is shown how to configure them both through DHCP. In the case of SBCX MINI there is only one ethernet interface, consequently going to configure only 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 the following:
 +
 
 +
<pre>
 +
[Match]
 +
Name=eth0
 +
 
 +
# Prevent the interface loading if the kernel boots from nfs
 +
KernelCommandLine=!nfsroot
 +
 
 +
[Network]
 +
DHCP=yes
 +
</pre>
 +
 
 +
In the event that there are another network interface, the configuration file as the following:
 +
 
 +
<pre>
 +
[Match]
 +
Name=eth1
 +
 
 +
# Prevent the interface loading if the kernel boots from nfs
 +
KernelCommandLine=!nfsroot
 +
 
 +
[Network]
 +
DHCP=yes
 +
</pre>
 +
 
 +
When systemd network starts, it tries to use a DHCP server present in the network to configure the interface.
 +
 
 +
==== DNS ====
 +
 
 +
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 <code>resolved</code> service should be resarted:
 +
 
 +
systemctl restart systemd-resolved
 +
 
 +
==== loopback network interface ====
 +
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 ====
 +
After editing the above files, changes are applied after reboot or by restarting <code>systemd-networkd.service</code>:<syntaxhighlight lang="bash">
 +
root@desk-mx8mp:~# systemctl restart systemd-networkd.service
 +
</syntaxhighlight>
 +
 
 
<section end=Body/>
 
<section end=Body/>
 
----
 
----
  
 
[[Category:MITO 8M]] [[Category:MITO 8M Mini]] [[Category:ORCA]]
 
[[Category:MITO 8M]] [[Category:MITO 8M Mini]] [[Category:ORCA]]

Latest revision as of 18:21, 27 December 2023

History
Issue Date Notes

2022/01/14

First DESK-MX8M-L release
2023/02/24 DESK-MX8M-L-2.0.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, below is shown how to configure them both through a static IP. In the case of SBCX MINI there is only one ethernet interface, consequently going to configure only 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
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
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, below is shown how to configure them both through DHCP. In the case of SBCX MINI there is only one ethernet interface, consequently going to configure only 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 the following:

[Match]
Name=eth0

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

[Network]
DHCP=yes

In the event that there are another network interface, the configuration file as the following:

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

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