Open main menu

DAVE Developer's Wiki β

Changes

How to configure the network interfaces

974 bytes added, 08:19, 26 October 2022
DNS
{{InfoBoxTop}}
{{AppliesToAxel}}
{{AppliesToAxelLite}}
{{AppliesToAxelEsatta}}
{{Applies To Bora}}
{{Applies To BoraX}}
{{Applies To BoraLite}}
{{Applies To Diva}}
{{InfoBoxBottom}}
 
<section begin=Body/>
 
== How to configure the network interfaces ==
* IP address of the device '''192.168.1.100'''
=== systemd SysV === The configuration files for SysV can be found in pre-defined directorys as written [https://en.wikibooks.org/wiki/Linux_Networking/Where_should_I_put_the_configuration_commands%3F here] Basically, for network configuration, it should be enough to properly configure the <code>/etc/network/interfaces</code> file.
The network configuration for systemd are basically found in the <code> # /etc/systemd/network/</code> directory.interfaces -- configuration file for ifup(8), ifdown(8)
The most simply way for configuring the network interface is to create/edit the Here below an example of configuration 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 The network interfaces, below interface is shown how to configure them both through configured with a static IP. In address by creating the case of SBCX MINI there is only one ethernet interface, consequently going to configure only eth0 interface.configuration entry in the '''/etc/network/interfaces''' file as the following:
Example for ethernet interface 0.
<pre>
[Match]auto eth0iface eth0 inet static address 192.168.1.100 netmask 255.255.255.0 gateway 192.168.1.254</pre> Name=eth0=== Dynamic IP addres (DHCP) ====
# Prevent The network interface is configured - using a proper DHCP server on the network - by creating the configuration entry in the interface loading if '''/etc/network/interfaces''' file as the kernel boots from nfsKernelCommandLine=!nfsrootfollowing:
[Network]<pre>Address=192.168.1.100allow-hotplug eth0Gateway=192.168.1.254DNS=192.168.1.1iface eth0 inet dhcp
</pre>
Example for ethernet When the Linux kernel detects the physical interface 1eth0, the iface causes ''ifup'' to use DHCP to configure the interface. ==== DNS ==== If the <code>resolvconf</code> package is not installed, the DNS configuration can be done manually by editing the '''/etc/resolv.conf''' as the following: 
<pre>
[Match]nameserver 192.168.1.1Name=eth1</pre> For example, it can be done on the command line echoing the string in this way:  root@axel-lite:~# echo "nameserver 192.168.1.1" > /etc/resolv.conf
# Prevent the ==== loopback network interface loading if the kernel boots from nfsKernelCommandLine=!nfsroot===
[Network]The following configuration entry in the '''/etc/network/interfaces''' file brings up the loopback network interface lo upon booting the system.Address=192.168.1.101<pre># The loopback interfaceGateway=192.168.1.254auto loDNS=192.168.1.1iface lo inet loopback
</pre>
Once modified, This one always exists in the <code>networkd<''/code> service should be resarted:etc/network/interfaces'' file. === systemd ===
systemctl restart The network configuration for systemd-networkdare basically found in the <code>/etc/systemd/network/</code> directory.
==== Dynamic IP addres (DHCP) ====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.
SBC ORCA has two network interfacesFor more example and usage hints on systemd, below is shown how please refer to configure them both through DHCP. In the case of SBCX MINI there is only one ethernet interface, consequently going to configure only eth0 interfaceour [[XELK-AN-008:_How_to_use_systemd_on_an_Embedded_system#Configuring_the_network_interfaces | wiki]] page.
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:==== Static IP address ====
<pre>
[Network]
DHCPAddress=yes192.168.1.100Gateway=192.168.1.254DNS=192.168.1.1
</pre>
In Once modified, the event that there are another <code>networkd</code> service should be resarted:  systemctl restart systemd-networkd ==== Dynamic IP addres (DHCP) ==== 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=eth1eth0
# Prevent the interface loading if the kernel boots from nfs
==== 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-mx8mpimx6qdlxelk:~# systemctl restart systemd-networkd.service
</syntaxhighlight>
8,226
edits