DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2011-03-17 00:06:03

beefy314
Member
Registered: 2010-01-20
Posts: 41

Commands for wake on lan

I have installed optware and wakelan on my dns 323. I wish to turn on my pc by doing ssh to my nas and have it send magic packets.

My first attempt was successful however now, i cant seem to run the wakelan program/ script. When i checked the directory, it's in there but i cant run it like the first time when i installed it.

Can anyone help?

Offline

 

#2 2011-03-18 11:07:25

Mijzelf
Member / Developer
Registered: 2008-07-05
Posts: 709

Re: Commands for wake on lan

What happens when you try to run it?

Offline

 

#3 2011-03-18 13:49:52

wujo11
Member
Registered: 2008-09-16
Posts: 35

Re: Commands for wake on lan

Is WOL even possible on DNS-323? The ethernet is without power so how did you done it?

Offline

 

#4 2011-03-18 16:33:10

fordem
Member
Registered: 2007-01-26
Posts: 1938

Re: Commands for wake on lan

wujo11 wrote:

Is WOL even possible on DNS-323? The ethernet is without power so how did you done it?

He's not trying to wake the DNS-323, he's trying to wake a PC.

beefy314 wrote:

I wish to turn on my pc by doing ssh to my nas and have it send magic packets.

Last edited by fordem (2011-03-18 16:33:36)

Offline

 

#5 2011-03-18 19:15:58

beefy314
Member
Registered: 2010-01-20
Posts: 41

Re: Commands for wake on lan

When I type wakelan, it says no such file.. even if I go to the directory where it is installed at.

I found the following commands which worked

mount --bind /mnt/HD_a2/ipkg/opt /opt
export PATH=/opt/bin:/opt/sbin:$PATH

then wakelan command is acknowledged..

is there a way so that I could just type the wakelan command without going through all those mount and export commands?

Offline

 

#6 2011-03-18 20:07:27

Mijzelf
Member / Developer
Registered: 2008-07-05
Posts: 709

Re: Commands for wake on lan

beefy314 wrote:

When I type wakelan, it says no such file.. even if I go to the directory where it is installed at.

Do you execute 'wakelan' or './wakelan'? In the first case the program might work if you provide the full path: /mnt/HD_a2/ipkg/opt/(s)bin/wakelan
In the second case the executable is dependent on one or more libraries which it searches in /opt/lib. In that case you'll at least have to execute the mount command. But you could put in fun_plug.

Offline

 

#7 2011-03-22 18:12:54

beefy314
Member
Registered: 2010-01-20
Posts: 41

Re: Commands for wake on lan

Mijzelf wrote:

beefy314 wrote:

When I type wakelan, it says no such file.. even if I go to the directory where it is installed at.

Do you execute 'wakelan' or './wakelan'? In the first case the program might work if you provide the full path: /mnt/HD_a2/ipkg/opt/(s)bin/wakelan
In the second case the executable is dependent on one or more libraries which it searches in /opt/lib. In that case you'll at least have to execute the mount command. But you could put in fun_plug.

Thanks Mijzelf! The command worked!

Is there a way to create a script so that when I type for example "wakelan", it automatically sends a set of commands?

Right now, I have to go into the directory where the wakelan program is, then execute wake lan along with the mac address of the PC i am waking. I want to just type one word which will then be equivalent to the whole set of stings I need to type

Last edited by beefy314 (2011-03-22 18:17:34)

Offline

 

#8 2011-03-22 18:41:58

FunFiler
Member
Registered: 2010-05-23
Posts: 577

Re: Commands for wake on lan

The the wakeonlan file/program into a location that is already on your path (/ffp/bin for example) or modify your path statement to include the directory that the program is in.


3 * (DNS-323 with 2 * 2TB) = 12TB Running FW v1.08 & FFP v0.5
Useful Links: Transmission, Transmission Remote, Automatic

Offline

 

#9 2011-03-23 10:56:12

Mijzelf
Member / Developer
Registered: 2008-07-05
Posts: 709

Re: Commands for wake on lan

You can easily create a script for that:

Code:

echo "#!/bin/sh" >mywakeup
echo "mount --bind /mnt/HD_a2/ipkg/opt /opt" >>mywakeup
echo "/full/path/to/wakeonlan AA:BB:CC:DD:EE:FF" >>mywakeup
chmod a+x mywakeup

Now you just have to type ./mywakeup.

Offline

 

#10 2011-03-23 12:24:24

beefy314
Member
Registered: 2010-01-20
Posts: 41

Re: Commands for wake on lan

Mijzelf wrote:

You can easily create a script for that:

Code:

echo "#!/bin/sh" >mywakeup
echo "mount --bind /mnt/HD_a2/ipkg/opt /opt" >>mywakeup
echo "/full/path/to/wakeonlan AA:BB:CC:DD:EE:FF" >>mywakeup
chmod a+x mywakeup

Now you just have to type ./mywakeup.

Hi Mijzelf.

I don't need to mount it.. all I have to do is the following

1. go to the directory mnt/HD_a2/ipkg/opt/bin
2. Then type ./wakelan -b xxx.xxx.xxx.xxx -m AA:BB:CC:DD:EE:FF

Can you kindly make me a code that I can type to make a script? Newbie here smile

Thanks for the help!

Last edited by beefy314 (2011-03-23 12:25:18)

Offline

 

#11 2011-03-23 12:57:29

Mijzelf
Member / Developer
Registered: 2008-07-05
Posts: 709

Re: Commands for wake on lan

Code:

echo "#!/bin/sh" >mywakeup
echo "/mnt/HD_a2/ipkg/opt/bin/wakelan -b xxx.xxx.xxx.xxx -m AA:BB:CC:DD:EE:FF" >>mywakeup
chmod a+x mywakeup

Offline

 

#12 2011-03-29 08:28:49

beefy314
Member
Registered: 2010-01-20
Posts: 41

Re: Commands for wake on lan

It worked! thanks mijzelf! smile

Offline

 

#13 2011-03-31 00:15:59

stephane_cha
Member
Registered: 2011-03-30
Posts: 8

Re: Commands for wake on lan

Hi all, i need to backup my pc's files on schedules times.

Step1: Hardware
i've just modify my DNS323 HW (revision B1) to autopoweron. (with a capacitor)
procedure : http://dns323.kood.org/hardware:autopow … _solutions
It's works fine !


Step 2 : Schedule
I turn-on the DNS323 only on Monday, Tuesday and Wednesday at the same time: 2.00am
procedure : with a 7 Day Programable Electronic Timer like this: http://www.amazon.co.uk/Programable-Ele … B0012D44PG
It's also works fine !

My Last step is: WOL my computer
When: on every "Schedule startup" of the DNS323 (step2)
procedure: I've just install optware and wakelan on DNS323

...but now, i don't know what to do to create a WOL script who starts with my DNS323 for wake-up my pc!

can you help me plz ?

Last edited by stephane_cha (2011-03-31 02:27:43)

Offline

 

#14 2011-03-31 03:58:30

FunFiler
Member
Registered: 2010-05-23
Posts: 577

Re: Commands for wake on lan

You could add the WOL command to /ffp/etc/fun_plug.local


3 * (DNS-323 with 2 * 2TB) = 12TB Running FW v1.08 & FFP v0.5
Useful Links: Transmission, Transmission Remote, Automatic

Offline

 

#15 2011-03-31 10:31:18

stephane_cha
Member
Registered: 2011-03-30
Posts: 8

Re: Commands for wake on lan

i have no experience, i've just follow tutorials to install optware. i'm trying to learn since last night but not easy.

...my last try of last night

make a file named : "wakelan.tgz" on root of volume_1 with theses parameters :

echo "#!/bin/sh" >mywakeup
echo "/mnt/HD_a2/ipkg/opt/bin/wakelan -b MY_PC_IP -m MY_PC_MAC_ADR" >>mywakeup
chmod a+x mywakeup

This file is near "fun_plug" file on root of volume_1
I rebooted NAS...

...but WOL is not working sad



@FunFiler :
if i understand your post, i need to create a file named "fun_plug.local" on /ffp/etc/ with following parameters ?

echo "#!/bin/sh" >mywakeup
echo "/mnt/HD_a2/ipkg/opt/bin/wakelan -b MY_PC_IP -m MY_PC_MAC_ADR" >>mywakeup
chmod a+x mywakeup

it is correct ?

Last edited by stephane_cha (2011-03-31 11:28:06)

Offline

 

#16 2011-03-31 13:10:33

FunFiler
Member
Registered: 2010-05-23
Posts: 577

Re: Commands for wake on lan

All you need to do is add :
/mnt/HD_a2/ipkg/opt/bin/wakelan -b MY_PC_IP -m MY_PC_MAC_ADR

to the existing /ffp/etc/fun_plug.local file. Put it near the end of the file.


3 * (DNS-323 with 2 * 2TB) = 12TB Running FW v1.08 & FFP v0.5
Useful Links: Transmission, Transmission Remote, Automatic

Offline

 

#17 2011-03-31 13:34:21

stephane_cha
Member
Registered: 2011-03-30
Posts: 8

Re: Commands for wake on lan

i've only "fun_plug.init" on /ffp/etc/

"fun_plug.local" is on ffp\etc\examples

do i need to create it on /ffp/etc/ ???

Last edited by stephane_cha (2011-03-31 14:08:13)

Offline

 

#18 2011-03-31 15:00:28

FunFiler
Member
Registered: 2010-05-23
Posts: 577

Re: Commands for wake on lan

Ya, I for got that it is not there by default........
Ok then, do this:

Code:

echo "#!/bin/sh" >/ffp/etc/fun_plug.local
echo "/mnt/HD_a2/ipkg/opt/bin/wakelan -b MY_PC_IP -m MY_PC_MAC_ADR" >>/ffp/etc/fun_plug.local
chmod a+x /ffp/etc/fun_plug.local

This script (fun_plug.local) will run once every time you reboot your NAS.


3 * (DNS-323 with 2 * 2TB) = 12TB Running FW v1.08 & FFP v0.5
Useful Links: Transmission, Transmission Remote, Automatic

Offline

 

#19 2011-03-31 18:26:35

stephane_cha
Member
Registered: 2011-03-30
Posts: 8

Re: Commands for wake on lan

ok, fun_plug.local is now created

i suspend my pc and shutdown DNS323.
i tryed to startup DNS323 but no WOL of my pc sad

I tryed to telnet DNS323 manually execute this command:
/mnt/HD_a2/ipkg/opt/bin # wakelan -b 169.254.1.2 -m 00:22:15:70:88:6D

and it's return

/ffp/bin/sh: wakelan: not found

Last edited by stephane_cha (2011-03-31 19:03:53)

Offline

 

#20 2011-03-31 18:56:28

FunFiler
Member
Registered: 2010-05-23
Posts: 577

Re: Commands for wake on lan

The answer to "not found" is in post #6.


3 * (DNS-323 with 2 * 2TB) = 12TB Running FW v1.08 & FFP v0.5
Useful Links: Transmission, Transmission Remote, Automatic

Offline

 

#21 2011-03-31 18:57:46

stephane_cha
Member
Registered: 2011-03-30
Posts: 8

Re: Commands for wake on lan

oups !

now i execute this :
# /mnt/HD_a2/ipkg/opt/bin/wakelan -b XXX.XXX.XXX.XXX -m 00:00:00:00:00:00

and no error return, so i think command line is good.

i can't test if it's working or not because i execute command on pc to WOL

=> My DNS323 is directly connected to my PC

is WOL working in this situation?

Last edited by stephane_cha (2011-03-31 19:13:45)

Offline

 

#22 2011-03-31 21:11:36

FunFiler
Member
Registered: 2010-05-23
Posts: 577

Re: Commands for wake on lan

There is no way to verify that it works without actually trying it that I am aware of. If you followed post #18 exactly, then it should work when you restart your NAS assuming you have the correct IP (or broadcast) and MAC addresses.

You should verify that the parameters are correct. I'm not familiar with the specific version you are installing, but I would assume that the '-b' is actually for the broadcast address, not the specific IP address. In other words, you should be able to use 255.255.255.255.

i.e.
/mnt/HD_a2/ipkg/opt/bin/wakelan -b 255.255.255.255 -m [actual MAC address here]

The MAC address is the important value and must of course match the actual value of your NIC.

It worries me that you masked (X-ed) out the IP address as it likely is irrelevant to anyone (192.168.x.y) yet you used zero's for the MAC which is critical that you use the proper value. Posting an actual MAC address isn't much of a security risk either, not that I care what your is.


For anyone interested in a perl script to perform the wakeonlan function, this is one I downloaded a while ago and use on my Linux box to wake my desktop:

Code:

#!/usr/bin/perl -w

eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
    if 0; # not running under some shell
#
# $Id: wakeonlan,v 1.4.2.3 2005/01/27 16:03:54 jpo Exp $
#
#########################################################################       

use strict;
use Socket;
use Getopt::Std;
use vars qw($VERSION $opt_v $opt_h $opt_i $opt_p $opt_f);
$VERSION = '0.41';

my $DEFAULT_IP      = '255.255.255.255';
my $DEFAULT_PORT    = getservbyname('discard', 'udp');

#
# Process the command line
#

getopts("hvp:i:f:");

if ($opt_h) { usage(); exit(0); }
if ($opt_v) { print "wakeonlan version $VERSION\n"; exit(0); }
if (!$opt_f and !@ARGV) { usage(); exit(0); }
if ($opt_i) { $DEFAULT_IP = $opt_i; }        # override default value
if ($opt_p) { $DEFAULT_PORT = $opt_p; }        # override default value

if ($opt_f) { process_file($opt_f); }

# The rest of the command line is a list of hardware addresses 

foreach (@ARGV) {
    wake($_, $opt_i, $opt_p);
} 

#
# wake
#
# 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, in this case an UDP packet targeted at the
# discard port (9).
#                                                                               

sub wake
{
    my $hwaddr  = shift;
    my $ipaddr  = shift || $DEFAULT_IP;
    my $port    = shift || $DEFAULT_PORT;

    my ($raddr, $them, $proto);
    my ($hwaddr_re, $pkt);
    
    # Validate hardware address (ethernet address)

    $hwaddr_re = join(':', ('[0-9A-Fa-f]{1,2}') x 6);
    if ($hwaddr !~ m/^$hwaddr_re$/) {
        warn "Invalid hardware address: $hwaddr\n";
        return undef;
    }

    # Generate magic sequence

    foreach (split /:/, $hwaddr) {
        $pkt .= chr(hex($_));
    }
    $pkt = chr(0xFF) x 6 . $pkt x 16;

    # Allocate socket and send packet

    $raddr = gethostbyname($ipaddr);
    $them = pack_sockaddr_in($port, $raddr);
    $proto = getprotobyname('udp');

    socket(S, AF_INET, SOCK_DGRAM, $proto) or die "socket : $!";
    setsockopt(S, SOL_SOCKET, SO_BROADCAST, 1) or die "setsockopt : $!";

    print "Sending WOL packet to $ipaddr:$port with $hwaddr\n";

    send(S, $pkt, 0, $them) or die "send : $!";
    close S;
}

#
# process_file
#

sub process_file {
    my $filename = shift;
    my ($hwaddr, $ipaddr, $port);

    open (F, "<$filename") or die "open : $!";
    while(<F>) {
        next if /^\s*#/;        # ignore comments
        next if /^\s*$/;        # ignore empty lines

        chomp;
        ($hwaddr, $ipaddr, $port) = split;

        wake($hwaddr, $ipaddr, $port);
    }
    close F;
}


#
# Usage
#

sub usage {
print <<__USAGE__;
Usage
    wakeonlan [-h] [-v] [-i IP_address] [-p port] [-f file] [[hardware_address] ...]

Options
    -h
        this information
    -v
        displays the script version
    -i ip_address
        set the destination IP address
        default: 255.255.255.255 (the limited broadcast address)
    -p port
        set the destination port
        default: 9 (the discard port)
    -f file 
        uses file as a source of hardware addresses

See also
    wakeonlan(1)    

__USAGE__
}


__END__

# Script documentation

=head1 NAME

wakeonlan - Perl script to wake up computers

=head1 SYNOPSIS

wakeonlan [-h] [-v] [-i IP_address] [-p port] [-f file] [[hardware_address] ...]

=head1 DESCRIPTION

This script sends 'magic packets' to wake-on-lan enabled ethernet adapters and motherboards, in order to switch on the called PC. Be sure to connect the NIC with the motherboard if neccesary, and enable the WOL function in the BIOS.

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. This script uses UDP packets.

=head1 OPTIONS

=over

=item B<-h>

Displays the help information.

=item B<-v>

Displays the script version.

=item B<-i ip_address>

Destination IP address. Unless you have static ARP tables you should
use some kind of broadcast address (the broadcast address of the network where the computer resides or the limited broadcast address). Default: 255.255.255.255 (the limited broadcast address).

=item B<-p port>

Destination port. Default: 9 (the discard port).

=item B<-f file>

File with hardware addresses of wakeable computers. For an example check
the file lab001.wol in the examples subdirectory.

=back

=head1 EXAMPLES

Using the limited broadcast address (255.255.255.255):

    $ wakeonlan 01:02:03:04:05:06
    $ wakeonlan 01:02:03:04:05:06 01:02:03:04:05:07

Using a subnet broadcast address:

    $ wakeonlan -i 192.168.1.255 01:02:03:04:05:06

Using another destination port:

    $ wakeonlan -i 192.168.1.255 -p 1234 01:02:03:04:05:06

Using a file as source of hardware and IP addresses:

    $ wakeonlan -f examples/lab001.wol
    $ wakeonlan -f examples/lab001.wol 01:02:03:04:05:06

=head1 AUTHOR

José Pedro Oliveira <jpo@di.uminho.pt> maintaining and expanding original work done by Ico Doornekamp <ico@edd.dhs.org>.

=head1 COPYRIGHT

Copyright (c) 2000-2005 José Pedro Oliveira.

This is free software.  You may modify it and distribute it under Perl's Artistic Licence.  Modified versions must be clearly indicated.                                                    

=head1 SEE ALSO

For more information regarding this script and Wakeonlan technology just check the following address http://gsd.di.uminho.pt/jpo/software/wakeonlan/.

=cut

To run it, I simply type "wakeonlan 00:17:31:85:a3:44" as it uses a default broadcast address.

Last edited by FunFiler (2011-03-31 21:26:39)


3 * (DNS-323 with 2 * 2TB) = 12TB Running FW v1.08 & FFP v0.5
Useful Links: Transmission, Transmission Remote, Automatic

Offline

 

#23 2011-03-31 22:09:14

stephane_cha
Member
Registered: 2011-03-30
Posts: 8

Re: Commands for wake on lan

FunFiler wrote:

There is no way to verify that it works without actually trying it that I am aware of. If you followed post #18 exactly, then it should work when you restart your NAS assuming you have the correct IP (or broadcast) and MAC addresses.
You should verify that the parameters are correct.

I did correctly #18

...Volume_1\ffp\etc\fun_plug.local

Code:

#!/bin/sh
/mnt/HD_a2/ipkg/opt/bin/wakelan -b 169.254.1.2 -m 00:22:15:70:88:6D

in notepad, command look like this:

Code:

#!/bin/sh/mnt/HD_a2/ipkg/opt/bin/wakelan -b 169.254.1.2 -m 00:22:15:70:88:6D

and i don't know if it's correct ?!


FunFiler wrote:

but I would assume that the '-b' is actually for the broadcast address, not the specific IP address. In other words, you should be able to use 255.255.255.255.

ok !

here's my PC ipconfig

Code:

   
Adresse physique . . . . . . . . . . . : 00-22-15-70-88-6D
Configuration automatique activée. . . : Oui
Adresse IPv4. . . . . . . . . . . . . .: 169.254.1.2(préféré)
Masque de sous-réseau. . . . . . . . . : 255.255.0.0

so, i've just try this on fun_plug.local:

Code:

/mnt/HD_a2/ipkg/opt/bin/wakelan -b 255.255.255.255 -m 00:22:15:70:88:6D

failed

Code:

/mnt/HD_a2/ipkg/opt/bin/wakelan -b 255.255.0.0 -m 00:22:15:70:88:6D

failed


FunFiler wrote:

For anyone interested in a perl script to perform the wakeonlan function, this is one I downloaded a while ago and use on my Linux box to wake my desktop

it is possible for me to install this on my dns and execute it on startup ?

thanks a lot for your help so precious !

Last edited by stephane_cha (2011-04-01 01:40:20)

Offline

 

#24 2011-04-01 01:08:45

FunFiler
Member
Registered: 2010-05-23
Posts: 577

Re: Commands for wake on lan

At this point, it is hard to say what is up in your environment.

Did you set static IP addresses on both the NAS and your PC? Are they in the same subnet? Did you set the default gateway correctly?

Did you check the funplug log file to see if it ran fun_plug.local or if it threw an error?


3 * (DNS-323 with 2 * 2TB) = 12TB Running FW v1.08 & FFP v0.5
Useful Links: Transmission, Transmission Remote, Automatic

Offline

 

#25 2011-04-01 01:19:29

stephane_cha
Member
Registered: 2011-03-30
Posts: 8

Re: Commands for wake on lan

my last try was to suspend PC and unplug DNS323. I plugged a laptop and try a WOL sofware to be sure of my NIC config.

=> WOL was OK, my PC started !

So, something wrong in my DNS323 config/script

___NAS___
Static IP: 164.254.1.1
Mask: 255.255.0.0
gateway: 169.254.1.100

___PC___
Static IP: 164.254.1.2
Mask: 255.255.0.0
gateway: 169.254.1.100

___ffp_log___
**** fun_plug script for DNS-323 (2008-08-11 tp@fonz.de) ****
Thu Mar 31 23:22:46 GMT 2011
ln -snf /mnt/HD_a2/ffp /ffp
* Running /ffp/etc/fun_plug.init ...
* Running /ffp/etc/fun_plug.local ...
* Running /ffp/etc/rc ...
* /ffp/start/syslogd.sh inactive
* /ffp/start/SERVERS.sh inactive
* /ffp/start/portmap.sh inactive
* /ffp/start/unfsd.sh inactive
* /ffp/start/nfsd.sh inactive
* /ffp/start/ntpd.sh inactive
* /ffp/start/LOGIN.sh inactive
* /ffp/start/telnetd.sh ...
Starting /ffp/sbin/telnetd -l /ffp/bin/sh
* /ffp/start/sshd.sh inactive
* /ffp/start/rsyncd.sh inactive
* /ffp/start/mediatomb.sh inactive
* /ffp/start/kickwebs.sh inactive
* /ffp/start/lighttpd.sh inactive
* /ffp/start/inetd.sh inactive
*  OK

Last edited by stephane_cha (2011-04-01 01:35:53)

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB