[133585] in North American Network Operators' Group

home help back first fref pref prev next nref lref last post

Re: Wake on LAN in the enterprise

daemon@ATHENA.MIT.EDU (Daniel Hagerty)
Mon Dec 13 12:47:25 2010

To: Owen DeLong <owen@delong.com>
From: Daniel Hagerty <hag@linnaean.org>
Date: 13 Dec 2010 12:47:17 -0500
In-Reply-To: Owen DeLong's message of "Mon, 13 Dec 2010 08:20:20 -0800"
Cc: nanog@nanog.org
Errors-To: nanog-bounces+nanog.discuss=bloom-picayune.mit.edu@nanog.org

Owen DeLong <owen@delong.com> writes:

> WOL is unfortunately terribly deficient in that the spec. never =
> envisioned the possibility
> of a need for wake on WAN.
> 
> Bottom line, it's a non-routeable layer 2 protocol. Your choices boil =
> down to the
> helper address nightmare you describe or proxy servers on every subnet.

    WoL works just fine over routed networks; the magic packet format
doesn't preclude it.  I send WoL over routed networks several times a
day.  The only gotcha is that you need some kind of arrangement for
either directed broadcast, or hardcode ndp/arp entries.

Perl code snippet below:

    my $wolhost = "wolhost.example.com";
    my $wolhost_mac = "de:ad:be:ef:ca:fe";

    my $mac = $wolhost_mac;
    $mac =~ s/[: ]//g;

    # Use socat to build a wakeonlan packet inside a udp6 datagram.

    my $packed_bcast = pack("H12", "f" x 12);
    my $packed_mac = pack("H12", $mac);
    my $dgram = $packed_bcast . ( $packed_mac x 16);

    # 9 is the discard port.  For whatever reason, the wrong thing
    # happens when the port is referenced by name, despite having the
    # name in /etc/services.

    open(SOCAT, "|-",
	 (qw(socat -u STDIN),
	  "UDP6-DATAGRAM:$wolhost:9"))
	|| die "popen: $!";
    print SOCAT $dgram || die "print: $!";
    close(SOCAT);


home help back first fref pref prev next nref lref last post