Shop OBEX P1 Docs P2 Docs Learn Events
Wake on LAN — Parallax Forums

Wake on LAN

tmcrockertmcrocker Posts: 2
edited 2010-11-21 05:30 in Accessories
When I saw the Spinneret the first thing I thought of was possibly using it to perform a Wake on LAN function.
I can currently do WOL to my desktop PC as long as it is sent from inside my LAN.
This will not work if I'm coming from out on the public Internet.
One solution is to have an 'always on' PC or other device that can be communicated from "outside" and then (through a password or other authentication) trigger this device to issue the "magic packet" to execute a WOL on my desktop computer.
If I want to be able to remote control my home PC while on the road the PC has to be left on 24/7. I've been looking for an elegant way to wake it up while on the road so that it may then be remotely controlled via LogMeIn or other service.

TomC

Comments

  • $WMc%$WMc% Posts: 1,884
    edited 2010-11-10 16:45
    tmcrocker wrote: »
    When I saw the Spinneret the first thing I thought of was possibly using it to perform a Wake on LAN function.
    I can currently do WOL to my desktop PC as long as it is sent from inside my LAN.
    This will not work if I'm coming from out on the public Internet.
    One solution is to have an 'always on' PC or other device that can be communicated from "outside" and then (through a password or other authentication) trigger this device to issue the "magic packet" to execute a WOL on my desktop computer.
    If I want to be able to remote control my home PC while on the road the PC has to be left on 24/7. I've been looking for an elegant way to wake it up while on the road so that it may then be remotely controlled via LogMeIn or other service.

    TomC
    '
    This is a good idea.
    '
    I think the Spinneret could restart a PC after a power outage.
    '
    I use PC anywhere for the remote link,But if the power has blipped off theres no way to restart the PC with out pressing the power button.
    '
    I don't think My watt meter could detect the small power draw from the Spinneret running 24/7
    '
    I've order a Spinneret this may be My first project with it.
  • pacmanpacman Posts: 327
    edited 2010-11-10 23:21
    This is why I've ordered two...


    My Concept.

    A daughter board that plugs into the header and supply's power . This daughter board takes the output from the laptops power lead (so it's about 18V) drops it down to 3.3 and supplies the Spinneret.

    So
    1) power comes back on
    2) supply gets fed by laptop power supply being powered.
    3) Prop reads MAC addresses off the SD card
    4) Prop send magic packet to MAC addresses previously read
    5) Prop shuts down (till next time)

    I envisage that the SD file is just a text file, and it could contain LOTS of mac addresses (if required) or just one.

    So want to enter the spinneret contest?
  • tmcrockertmcrocker Posts: 2
    edited 2010-11-11 10:18
    Well, my interest is not causing the computer to restart after a power failure. One, because its on an UPS and Two, I want it to stay off until I need the desktop PC.

    There would be two halves to the project. The second half would to successfully transmit and have recognized the WOL packet.

    The first half that I've not see talk of, here, is communicating from the outside (Internet) and triggering it to execute the WOL or a selected WOL if there were multiple computers available to wake but only selectively.

    TomC
  • UltraLazerUltraLazer Posts: 30
    edited 2010-11-19 04:26
    I have recently implemented WOL with a propeller and a Wiznet W5100 module. Talking to my PC using a router as the LAN gateway.

    It should be mentioned that not all motherboard/BIOSs/Ethernet adapters respond to magic packets. Most modern hardware will Wake on Lan from sleep, but apparently it is a little less common that they be equipped to WOL from a powered down state or be able to be powered down remotely. Some older computers have a few jumper wires from Ethernet card to motherboard that may need to be connected.

    On my machine (win 7) I was able to allow WOL in the Device manager - Network adapters - Ethernet adapter - properties (right click) - power management. These settings may be in the BIOS under power management if windows does not give you the option.

    I used WIZnet W5100 SPI Driver Ver. 00.5 (thank you Timothy Swieter) available in the object exchange. His UDP echo demo to is an excellent place to start in terms of setting up the w5100 for UDP.

    To send the Magic Packet you need:

    1) The gateway IP address. Something like 192.168.1.255, only the computer designated by the MAC address in the packet will respond. I have read that it is best to broadcast the packet across the LAN by designating 255, Im not sure why, but it works.

    2) The host computers MAC address ( ipconfig -a in the Windows command prompt)
    [b]PUB[/b] Send_Magic | i, MACi
    
    ' ----------------Wake-On-LAN Magic Packet-------------- 
    'This packet should contain a synchronization stream of 6 bytes of $FF (generated by W5100) and 16 times the repetition of the victims MAC address.
    
    
    [b]Repeat[/b] i [b]from[/b] 0 to 3
      txDATA[­i] := WOL_broadcast_IP[­i] 'assign 
    
    txDATA[­4] := 0 'Destination port, UDP Discard port seems ok 
    txDATA[­5] := 9 'http://en.wikipedia.org/wiki/Discard_Protocol
    
    txDATA[­6] := 0 'Lenght of packet payload
    txDATA[­7] := 104 
    
    MACi := 0
    
    [b]repeat[/b] i [b]from[/b] 8 to 104 'Load 16 x 6 Byte MAC address repitetions into the        txDATA[­8] 
      [b]if[/b] MACi == 6 'starting at the payload
        MACi := 0
      txDATA[­i] := HostMAC[­MACi]
      MACi++
    
    ETHERNET.txUDP(0, @txBuffer[­0]) 
    
    '-------------------------------------------------------------
    
    

    I was shocked to see it work on the first try. That never happens. This packet was intercepted using WireShark.

    0000 ff ff ff ff ff ff 02 00 00 01 23 45 08 00 45 00 ........ ..#E..E.
    0010 00 84 00 01 40 00 80 11 74 0e c0 a8 02 0a c0 a8 ....@... t.......
    0020 02 ff 15 b3 00 09 00 70 fe 1a 00 1d 60 e2 75 4e .......p ....`.uN
    0030 00 1d 60 e2 75 4e 00 1d 60 e2 75 4e 00 1d 60 e2 ..`.uN.. `.uN..`.
    0040 75 4e 00 1d 60 e2 75 4e 00 1d 60 e2 75 4e 00 1d uN..`.uN ..`.uN..
    0050 60 e2 75 4e 00 1d 60 e2 75 4e 00 1d 60 e2 75 4e `.uN..`. uN..`.uN
    0060 00 1d 60 e2 75 4e 00 1d 60 e2 75 4e 00 1d 60 e2 ..`.uN.. `.uN..`.
    0070 75 4e 00 1d 60 e2 75 4e 00 1d 60 e2 75 4e 00 1d uN..`.uN ..`.uN..
    0080 60 e2 75 4e 00 1d 60 e2 75 4e 00 00 00 00 00 00 `.uN..`. uN......
    0090 00 00


    Hope this helps
  • GadgetmanGadgetman Posts: 2,436
    edited 2010-11-21 05:30
    The '255' isn't the Gateway address, it's the 'Broadcast' address, and ALL machines listen to that when they're on and a normal TCP/IP stack is loaded.
    (This address REALLY should be blocked in routers and FireWalls, as sending a PING with a faked return address and large packet-size to this address can really mess up the computer that owns the return address. Can flood the local network, too)

    Anyway, the adresses to look out for is:

    'Network address' , usually ends with a 0, or at least a number divisible by 8/16/32/64/128. It's the lowest address in the block, and not assigned to any computer.
    BroadCast Address, this is the highest address in the block, and incidentally, the last few (binary) digits are all '1'.
    'Gateway address', this is the router connecting your network to the rest of the world. this can be any address from NW+1 up until BC-1.
    Then there's the 'Subnet Mask' which in a typical home network looks like 255.255.255.0
    This is used to 'mask out' the last bits to decide whether or not a packet is destined to trave lto another network or not. Note, this also decides how large the network is.
    A '0' at the end means a block from x.x.x.0 to x.x.x.255 is available.
    I have worked with masks as small as 255.255.255.248, where the NW can be x.x.x.192. Then the BC is x.x.x.199
    (Yes, there really is a use for blocks that small. 1 Router/switch, 2 PCs, 1 networked printer = 4 addresses, + NW & BC = 6, leaving two for 'future expansion' Not that there was room for another user in that rig. )
    And going the other way, a 255.255.254.0 SM means that the block spans 512 addresses. Then you suddenly find that a x.x.x.255 address is actually a valid address for a computer.
Sign In or Register to comment.