Wake on LAN

Few days ago I had to go from work to home just to turn on my desktop computer. Now when I have possibility to remote login to my router I tried to get Wake-On-LAN working.

My desktop PC has 3 network cards:

  • 3Com 3c905b-tx (my favorite one which I use since 2001)
  • SMC 9332 DST (card from 1995 year — I bought it because it has good packet driver under DOS)
  • Via-Rhine 6102 (onboard — was disabled)

I installed “ethtool” and started to checking which card support WOL. First tested was 3Com one:

root@home:~# ethtool eth0
Settings for eth0:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Advertised auto-negotiation: Yes
        Speed: 10Mb/s
        Duplex: Half
        Port: MII
        PHYAD: 24
        Transceiver: internal
        Auto-negotiation: on
        Current message level: 0x00000001 (1)
        Link detected: no

As you see — no WOL here.. So I build “tulip” module and checked SMC card:

root@home:~# ethtool eth1
Settings for eth1:
No data available

It’s so old card that I was not suprised that it does not support WOL. Next step was rebooting machine, enable onboard LAN and enabling two other options in BIOS:

Wake on Onboard LAN
Wake on PCI card

Started Linux and started ethtool:

root@home:~# ethtool eth2
Settings for eth2:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Advertised auto-negotiation: Yes
        Speed: 100Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: pumbg
        Wake-on: d
        Current message level: 0x00000001 (1)
        Link detected: yes

And that card support WOL 🙂 So I retired 3Com card and now VIA-Rhine is my default NIC. I added one line to /etc/init.d/hrw-misc:

ethtool -s eth0 wol pumbg

to get WOL turned on on each reboot.

On router I installed “wol” package and created one line script “/sbin/wake-home”:

wol -i 192.168.1.255 xx:yy:zz:aa:bb:cc

where “xx:yy:zz:aa:bb:cc” is MAC address of desktop NIC.

Thanks goes to Jimmy for his entry in blog.

2 thoughts on “Wake on LAN”

  1. Did you ever find a way to send a Wake on LAN from the Zaurus to your home computer?

    Closest I’ve gotten is this shell script, but it needs arp or a nc with udp broadcast:

    #! /bin/sh
    
    # Usage: wake  []
    #
    #  can be a host name or a dotted-quad IP address.
    # If the  is not given, it is taken from ethers(5).
    # For this to work, if you give a host name as first argument, ethers
    # has to contain host names (as opposed to IP addresses).
    #
    # Unless you have it already, you can build your ethers file like this:
    #
    # nmap -sP -PI 192.168.1.0/24   # prepare ARP cache with a ping-sweep
    # arp -a | awk '$5 == "[ether]" { printf("%st%sn", $4, $1); }' 
    #        | sort >>/etc/ethers
    #
    # The 'magic packet' consists of 6 times 0xFF followed by 16 times
    # the hardware address of the NIC. This sequence can be encapsulated
    # in any kind of packet; I chose UDP to the discard port (9).
    
    if [ $# = 1 ]; then
      ETHER=`awk "/$1/"' { gsub(":", "", $1); print $1; exit; }'/etc/ethers`
      if [ -z $ETHER ]; then
        echo "$0: host $1 is not in /etc/ethers" >&2
        exit 1
      fi
    else
      ETHER=$2
    fi
    
    ETHER="${ETHER}${ETHER}${ETHER}${ETHER}"                # 4 x MAC
    ETHER="FFFFFFFFFFFF${ETHER}${ETHER}${ETHER}${ETHER}"    # Preamble + 16 x MACa
    
    ### doesn't work on OZ because nc, arp suck... :(
    ## probably has syntax errors too, haven't checked on real linux yet.
    
    ## Inject into ARP table
    arp -s 192.168.0.1 `awk "/$1/"' { gsub(":", "", $1); print $1; exit; }'/etc/ethers`
    
    ## netcat to start machine
    echo ${ETHER} | nc -b -u -p 7
    
  2. G: I never tried to wake my desktop from Zaurus – they are not in the same network.

    If I use USB networking then desktop must be ON to be able to connect with Zaurus.

    If I use WiFi card then all packets goes through my router/WAP.

    I don’t have Ethernet card for Zaurus to be able to wake machine from Z.

Comments are closed.