R-Car/Tests:sh eth

From eLinux.org
< R-Car
Revision as of 01:33, 6 February 2017 by Geert (talk | contribs) (Document wakeonlan as an alternative for etherwake)
Jump to: navigation, search

This document describes test procedures for Renesas Electronics SH EtherMAC.


Some versions of SH EtherMAC supports Wake-on-Lan using MagicPacket, this describes how to test it on the Renesas Koelsch board. Wake-on-Lan is not yet available in upstream Linux but exist in renesas-drivers tree (git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git).

To test WoL the target (Koelsch) and the host needs to have working network configuration. It's possible to have target and host on different subnets as long as packets can be routed directly from host to target. However for this test it is assumed target and host are directly connected and on the same subnet, that way we don't have to worry about routing and such. The network interface on target are named eth0 and the interface on the host are named net0.

1. Find out the MAC address of the target, for example by running the ip command on the target itself.

root@koelsch ~ # ip address show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 2e:09:0a:00:3d:cf brd ff:ff:ff:ff:ff:ff
    inet brd scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::2c09:aff:fe00:3dcf/64 scope link 
       valid_lft forever preferred_lft forever

The MAC address 2e:09:0a:00:3d:cf will be used in this example.

2. Set target to listen and wake-up by MagicPacket received on eth0 using ethtool.

root@koelsch ~ # ethtool -s eth0 wol g

3. Suspend target.

root@koelsch ~ # echo mem > /sys/power/state

4. Wake target up by sending MagicPacket from host interface net0 to a target with MAC address 2e:09:0a:00:3d:cf using the tool etherwake.

root@host ~ # etherwake -i net0 2e:09:0a:00:3d:cf

Alternatives to etherwake

There are alternatives to etherwake which can be used to send a MagicPacket. Examples are:

  • wol. If you use wol to send MagicPacket from a host with more then one network interface you are not asked with interface on the host to send on instead which IP address the target have, this is then used to figure out which interface to use. If the IP given to wol do not have a complete entry in the hosts ARP table it will be sent on the host default interface which might or might not be the correct, wol will in any case report that sending of MagicPacket are OK. If WoL do not work for you or more likely stops working at random please make sure MagicPacket are sent out on correct interface as the ARP cache entry might have expired.
  • wakeonlan. wakeonlan uses UDP instead of ICMP, so it can be used by normal (non-root) users. It also supports passing a target host name instead of a target MAC address, which is looked up in /etc/ethers (which you can copy from your DHCP/DNS server if it uses dnsmasq).