wake on lan / wol with linux in IPv6-LAN (without IPv4)

Thomas Schäfer thomas at cis.uni-muenchen.de
Wed Sep 17 22:24:33 CEST 2014


Am Dienstag, 16. September 2014, 14:34:13 schrieb Bjørn Mork:

> You could try something like this (might need a bit more error
> detection...):
> 
> #!/usr/bin/perl
> use Socket;
> use Socket6;
> my $iface = shift;
> my $mac = pack("C6", map { hex } split(/:/, shift || die "Usage: $0 <iface>
> <mac>\n")); socket(S, AF_INET6, SOCK_DGRAM, 17);
> require "sys/ioctl.ph";
> ioctl(S, &SIOCGIFINDEX, $iface);
> setsockopt(S, IPPROTO_IPV6, IPV6_MULTICAST_IF, substr($iface, 16));
> send(S, pack("C6", (255) x 6) . $mac x 16, 0, pack_sockaddr_in6(7,
> inet_pton(AF_INET6, "ff02::1")));
> 

The first try was ok for me. Thanks a lot!

Regards,
Thomas





More information about the ipv6-ops mailing list