ctys-wakeup

June, 2010

.

NAME

ctys-wakeup - WoL and IPMI


SYNTAX


ctys-wakeup


   [-d <level>]
   [-h]
   [-H <help-options>]
   [-i <interface>]
   [-n]
   [-p <port>]
   [-t <TCP/IP address>]
   [-V]
   [-X]
   <mac-address>





DESCRIPTION

ctys-wakeup (Address-Resolution) sends a so called MagicPacket(TM) to a given destination. In case a remote segment is addressed by setting the "-t" option, a UDP message is sent to port "9". The script consists of a few lines of bash code with a call to Netcat. So it could be adapted easily.

  mac=$1;shift
  ip=$1;shift
  
  function buildWOLMagicPacket () {
   local _mac=$1;shift
   declare -a _pdu;
  
   function macAsc2Hex () {
     for i in ${@};do
       printf "\x$i"
     done
   }
  
  
   #frame
   _pdu=(ff ff ff ff ff ff);
  
   #MAC addr in "little endian"
   addr=(${mac: })
   addrLitteEndian=(${addr[0]} ${addr[1]} \
                    ${addr[2]} ${addr[3]} \
                    ${addr[4]} ${addr[5]});
  
  
   #add 16 duplications
   for((i=0;i<16;i++));do
     for m in ${addrLitteEndian[@]};do
       size=${#_pdu[@]}
       _pdu[${size}]=$m
     done
   done
  
   macAsc2Hex ${_pdu[@]}
  }
  
  if [ -n "$ip" ];then
    printf "`buildWOLMagicPacket $mac`\n"|nc -u -w 1 $ip 9
    else
      buildWOLMagicPacket $mac
  fi



.

OPTIONS

-d <level>
Sets debug.

-h
Print help, refer to "-H" for additional information.

-H <help-option>
The extended help option is based on system interfaces for display of manpages, PDF and HTML documents. This comprises the man pages and installed manuals.

For additional help refer to the documents or type ctys -H help.

-i <broadcast-interface>
The ethernet-broadcast interface for local segment. When used "-t" option is not applicable.

-n
No execution, evaluation only.

-p <port>
The port for destination, which is by default "9" for a hard-coded UDP message. It is not really relevant, might be used only for adaptation to firewall rule.

-t <TCP/IP address>
When provided the packet is send to destination. The destination address could be a "directed-broadcast" address, which has to be supported by the router.

E.g. OpenBSD requires "net.init.ip.directed-broadcast=1", and the appropriate pf-rules.

For 1.2.3.4:
  <wol>    {1.2.3.255}
  
  pass  in  on \$ifX  from <wolExec> to <wol>  
  pass  out on \$ifY  from <wolExec> to <wol>

Alternatively a "rdr" - Redirection could be set. When this option is not provided, a UDP packet will be sent to "255:255:255:255:9".

When used "-i" option is not applicable.

-V
Version.

-X
See ctys, terse for machine output.

.

ARGUMENTS

The MAC address of the targeted NIC, this could be evaluated by call of "ctys-macmap" and/or "ctys-vhost"

.

EXIT-VALUES

0: OK:
Result is valid.

1: NOK:
Erroneous parameters.

2: NOK:
Missing an environment element like files or databases.


SEE ALSO

ctys use-cases
ctys-IPMI(7), ctys-WoL(7)

ctys plugins
PMs
ctys-PM(7)
VMs
ctys-KVM(7), ctys-QEMU(7), ctys-VMV(7), ctys-XEN(7), ctys-VBOX(7)
HOSTS
ctys-CLI(7), ctys-PM(7), ctys-VNC(7), ctys-X11(7)

ctys executables
ctys-extractARPlst(1), ctys-extractMAClst(1), ctys-genmconf(1), ctys-plugins(1), ctys-vping(1), ctys-vhost(1)

system executables
dmidecode(8), ether-tool(8), ether-wake(8), nc(1)<a.k.a. netcat>


AUTHOR

Written and maintained by Arno-Can Uestuensoez:

Maintenance: <<acue_sf1 (a) sourceforge net>>
Homepage: <https://arnocan.wordpress.com>
Sourceforge.net: <http://sourceforge.net/projects/ctys>
Project moved from Berlios.de to OSDN.net: <https://osdn.net/projects/ctys>
Commercial: <https://arnocan.wordpress.com>




COPYRIGHT

Copyright (C) 2008, 2009, 2010 Ingenieurbuero Arno-Can Uestuensoez

For BASE package following licenses apply,

This document is part of the DOC package,

For additional information refer to enclosed Releasenotes and License files.