[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Wake on LAN in the enterprise
- Subject: Wake on LAN in the enterprise
- From: hag at linnaean.org (Daniel Hagerty)
- Date: 13 Dec 2010 12:47:17 -0500
- In-reply-to: Owen DeLong's message of "Mon, 13 Dec 2010 08:20:20 -0800"
- References: <[email protected]> <[email protected]>
Owen DeLong <owen at 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);