The STKa7x Starter Kit provides two Gigabit Ethernet interfaces.
In U-Boot, end0 is configured as the default interface. The IP configuration can be done statically or by a DHCP server in the network.
IP configuration via DHCP
For a configuration via a DHCP server, use the dhcp command in U-Boot.
Static IP configuration For a static IP configuration the following U-Boot environment variables must be set:
setenv ipaddr <ipaddr> (e.g.: setenv ipaddr 192.168.100.111) setenv netmask <netmask> (e.g.: setenv netmask 255.255.255.0)
Both Ethernet interfaces are activated and configured by systemd-networkd. The configuration files for the interfaces are located in /lib/systemd/network/ and can be altered to customize the default interface configuration. A documentation of the configuration files can be found here.
The ip command can be used for a temporary static configuration. Some useful ip commands are listed below:
Activate a specific interface
e.g. end0
ip link set end0 up
Disable a specific interface
e.g. end0
ip link set end0 down
Show IP address for a specific interface
e.g. end0
ip addr show end0
Show statistics for a specific interface
e.g. end0
ip -s link show end0
Set IP address for a specific interface
e.g. end0
ip addr add 192.168.1.100/24 dev end0
Show statistics of all interfaces
ip -s link
Set default gateway for a specific interface
e.g. set gateway IP 192.168.1.1 for end0
ip route add default via 192.168.1.1 dev end0
If a DHCP server is available in the network environment, the IP configuration can be obtained. To do so execute the udhcpc command; by default, end0 is used.
To configure another interface via DHCP, provide the parameter -i followed by the interface name (e.g. end1).
udhcpc -i end1
The STKa7x supports Wake on LAN (WoL). Follow the steps below to put the system into sleepmode and wake it up again.
Activate WoL on STKa7x:
Check WoL compatability with ethtool, the line Supports Wake-on: g, confirms that WoL is supported. The line below, Wake-on: d means it is currently disabled.
To enable WoL temporarily, the following command can be used:
ethtool -s <interface> wol g # e.g. ethtool -s end0 wol g
Activate WoL permanently by creating a systemd file:
nano /usr/lib/systemd/network/10-eth0.link
Fill the new file with the following content:
[Match] OriginalName=<interface name (e.g. end0)> [Link] WakeOnLan=magic
Finally, reboot the system.
Now, ethtool <interface> should print Wake-on: g
Get MAC Address of the Ethernet interface:
The Ethernet interfaces MAC address is mandatory to send the WoL magic package and wake up a system. It can be obtained by using:
ip a ip link show dev <interface> #e.g. ip link show dev end0
This command also shows the IP address, which will be needed later on for Windows hosts.
Put the system to sleep:
echo mem > /sys/power/state
Wake the system up again:
The tool WakeMeOnLAN can be used to wake up the sleeping system.
To wake up the system, go to “Options” → “Advanced Options” and select the correct Ethernet adapter or the correct IP address range. Then use the green button on the main page to scan for devices.
Alternatively, go to “File” → “Add New Computer” and fill the form with the correct IP address and MAC address.
Finally, select the device with the correct MAC address, click on the clock symbol in the top left corner and choose “yes”.
The command etherwake can be utilized by executing the following steps:
sudo apt install etherwake etherwake -i <host interface> <MAC address>