[Wapt] wakeonlan
Fonteneau Simon
sfonteneau at stemarie-aizenay.fr
Thu Feb 25 17:26:16 CET 2016
Bonjour
Je viens de modifier waptserver.py comme ceci aujourd'hui en bricolage
car je ne parviens pas a récupérer le champ broadcast dans la base
mongodb de wapt
Je le poste ici, cela peut servir.
def trigger_wakeonlan():
try:
uuid = request.args['uuid']
host_data = hosts().find_one({ "uuid":
uuid},fields={'uuid':1,'host':1,'computer_fqdn':1})
macs = host_data['host']['mac']
msg = u''
if macs:
logger.info(_("Sending magic wakeonlan packets to {} for
machine {}").format(macs,host_data['host']['computer_fqdn']))
broadcast='172.28.255.255'
wakeonlan.wol.send_magic_packet(*macs,ip_address='%s' %
broadcast)
broadcast='172.29.255.255'
wakeonlan.wol.send_magic_packet(*macs,ip_address='%s' %
broadcast)
wakeonlan.wol.send_magic_packet(*macs)
Merci
Simon
Collège Privé Ste Marie <https://www.stemarie-aizenay.fr>
Fonteneau Simon / Administrateur Réseaux
sfonteneau at stemarie-aizenay.fr <mailto:sfonteneau at stemarie-aizenay.fr>/
0648761484
Collège Privé Ste Marie
Tel: 0251946200 / Fax: 0251946856
24 route de Nantes 85190 Aizenay
https://www.stemarie-aizenay.fr
Facebook <https://www.facebook.com/saintemarieaizenay>Google +
<https://plus.google.com/105273696200535069375>LinkedIn
<https://fr.linkedin.com/in/simon-fonteneau-b13382b0>Maps
<https://goo.gl/maps/Jbyn8JUpumq>
Le 24/02/2016 23:23, Fonteneau Simon a écrit :
> Je me permet de re-réponde a la liste entière, la réponse peut servir
> pour d'autre.
>
> Avec "ip directed-broadcast" sur les vlan concernée sur les cisco il
> est possible de contourner le problème justement.
>
> En faite je fait déjà comme ceci depuis des années. Je démarre tout
> mes poste prof du lycée le matin avec un serveur qui n'est pas dans le
> même vlan que mes pc.
>
> J'ai justement testée en changeant l'ip broadcast dans le fichier
> /opt/wapt/lib/site-packages/wakeonlan/wol.py de 255.255.255.255 à
> 172.21.255.255
>
> Et la effectivement le wapt fonctionne. Donc mon soucis vient bien
> d'ici. Mais comme j'ai plusieur vlan, je souhaite modifier le
> waptserver.py
>
> Simon
>
>
> Le 24/02/2016 22:57, MORILLO Jordi a écrit :
>> Bonsoir Simon,
>>
>> Peut-être n'ai-je pas compris ce que tu voulais faire exactement mais normalement, d'après mes bases lointaines de réseau et couche OSI, le broadcast ne passe la couche 3 donc n'est pas routé (sauf le dhcp si on specifie un relais)
>> Pour faire du WOL sur un poste qui n'est pas sur le même réseau, tu dois passer par un poste relais se situant sur le même réseau que le poste.
>> Bonne soirée
>> Jordi
>>
>> ________________________________
>> De : WAPT [wapt-bounces at lists.tranquil.it] de la part de Fonteneau Simon [sfonteneau at stemarie-aizenay.fr]
>> Date d'envoi : mercredi 24 février 2016 18:51
>> À :wapt at lists.tranquil.it
>> Objet : Re: [Wapt] wakeonlan
>>
>> Bonjour
>>
>> J'ai commencée a regarder comment modifier mon problème
>>
>> J'ai compris que cela se passe dans waptserver.py dans la fonction def trigger_wakeonlan():
>>
>>
>> def trigger_wakeonlan():
>> try:
>> uuid = request.args['uuid']
>> host_data = hosts().find_one({ "uuid": uuid},fields={'uuid':1,'host':1,'computer_fqdn':1})
>>
>> macs = host_data['host']['mac']
>> msg = u''
>> if macs:
>> logger.info(_("Sending magic wakeonlan packets to {} for machine {}").format(macs,host_data['host']['computer_fqdn']))
>> wakeonlan.wol.send_magic_packet(*macs)
>>
>> J'ai vu également que le fichier wol.py est déjà capable de prendre en charge l'argument ip_address pour résoudre mon soucis.:
>>
>> def send_magic_packet(*macs, **kwargs):
>> """
>> Wakes the computer with the given mac address if wake on lan is
>> enabled on that host.
>>
>> Keyword arguments:
>> :arguments macs: One or more macaddresses of machines to wake.
>> :key ip_address: the ip address of the host to send the magic packet
>> to (default "255.255.255.255")
>> :key port: the port of the host to send the magic packet to
>> (default 9)
>>
>> """
>>
>>
>> Je voudrais maintenant récupérer le champ broadcast dans dispo dans la base de wapt.
>>
>> J'ai donc essayée avec host_data['host']['networking']['broadcast']
>>
>> Mais j'ai du mal a comprendre
>>
>> Un petit coup de main ?
>>
>> Simon
>>
>>
>>
>>
>>
>>
>> Le 24/02/2016 15:59, Fonteneau Simon a écrit :
>> Pour ceux qui tomberai sur ce poste plus tard
>> Le broadcast wakeonlan est défini ici
>> /opt/wapt/lib/site-packages/wakeonlan/wol.py
>>
>> Merci
>>
>> Simon
>>
>> [Collège Privé Ste Marie]<https://www.stemarie-aizenay.fr>
>>
>> Fonteneau Simon / Administrateur Réseaux
>> sfonteneau at stemarie-aizenay.fr<mailto:sfonteneau at stemarie-aizenay.fr> / 0648761484
>>
>> Collège Privé Ste Marie
>> Tel: 0251946200 / Fax: 0251946856
>> 24 route de Nantes 85190 Aizenay
>> https://www.stemarie-aizenay.fr
>>
>> [Facebook]<https://www.facebook.com/saintemarieaizenay> [Google +]<https://plus.google.com/105273696200535069375> [LinkedIn]<https://fr.linkedin.com/in/simon-fonteneau-b13382b0> [Maps]<https://goo.gl/maps/Jbyn8JUpumq>
>>
>>
>>
>>
>> Le 24/02/2016 15:29, Fonteneau Simon a écrit :
>> Bonjour
>>
>> Je viens de tester le wakeonlan de wapt.
>> Si je ne me trompe pas le wakeonlan est envoyée a 255.255.255.255
>>
>> Chez moi le wakeonlan est derrière une gateway, et le serveur wapt n'est pas dans le même vlan que mes clients
>>
>> Il me faut donc envoyer sur wakeonlan -i 172.21.255.255 BC:EE:7B:9E:51:E2
>> Au lieu de wakeonlan -i 255.255.255.255 BC:EE:7B:9E:51:E2
>>
>> Il y a t'il possibilités d'adaptée cela en lisant l'adresse ip et le netmask du client ??
>>
>> Envoie a 255.255.255.255 et le au broadcast du dernier réseaux de la dernière ip connue pour gérer les poste nomade.
>>
>> Merci Qu'en pensez vous
>>
>> Simon
>> --
>>
>> [Collège Privé Ste Marie]<https://www.stemarie-aizenay.fr>
>>
>> Fonteneau Simon / Administrateur Réseaux
>> sfonteneau at stemarie-aizenay.fr<mailto:sfonteneau at stemarie-aizenay.fr> / 0648761484
>>
>> Collège Privé Ste Marie
>> Tel: 0251946200 / Fax: 0251946856
>> 24 route de Nantes 85190 Aizenay
>> https://www.stemarie-aizenay.fr
>>
>> [Facebook]<https://www.facebook.com/saintemarieaizenay> [Google +]<https://plus.google.com/105273696200535069375> [LinkedIn]<https://fr.linkedin.com/in/simon-fonteneau-b13382b0> [Maps]<https://goo.gl/maps/Jbyn8JUpumq>
>>
>>
>>
>>
>>
>>
>> --
>>
>> [Collège Privé Ste Marie]<https://www.stemarie-aizenay.fr>
>>
>> Fonteneau Simon / Administrateur Réseaux
>> sfonteneau at stemarie-aizenay.fr<mailto:sfonteneau at stemarie-aizenay.fr> / 0648761484
>>
>> Collège Privé Ste Marie
>> Tel: 0251946200 / Fax: 0251946856
>> 24 route de Nantes 85190 Aizenay
>> https://www.stemarie-aizenay.fr
>>
>> [Facebook]<https://www.facebook.com/saintemarieaizenay> [Google +]<https://plus.google.com/105273696200535069375> [LinkedIn]<https://fr.linkedin.com/in/simon-fonteneau-b13382b0> [Maps]<https://goo.gl/maps/Jbyn8JUpumq>
>>
>
> --
>
> Collège Privé Ste Marie <https://www.stemarie-aizenay.fr>
>
> Fonteneau Simon / Administrateur Réseaux
> sfonteneau at stemarie-aizenay.fr
> <mailto:sfonteneau at stemarie-aizenay.fr>/ 0648761484
>
> Collège Privé Ste Marie
> Tel: 0251946200 / Fax: 0251946856
> 24 route de Nantes 85190 Aizenay
> https://www.stemarie-aizenay.fr
>
> Facebook <https://www.facebook.com/saintemarieaizenay>Google +
> <https://plus.google.com/105273696200535069375>LinkedIn
> <https://fr.linkedin.com/in/simon-fonteneau-b13382b0>Maps
> <https://goo.gl/maps/Jbyn8JUpumq>
>
-------------- section suivante --------------
Une pi?ce jointe HTML a ?t? nettoy?e...
URL: <http://lists.tranquil.it/pipermail/wapt/attachments/20160225/7c6f9994/attachment-0001.html>
-------------- section suivante --------------
Une pi?ce jointe autre que texte a ?t? nettoy?e...
Nom: stemarieaizenaysf.png
Type: image/png
Taille: 8867 octets
Desc: non disponible
URL: <http://lists.tranquil.it/pipermail/wapt/attachments/20160225/7c6f9994/attachment-0010.png>
-------------- section suivante --------------
Une pi?ce jointe autre que texte a ?t? nettoy?e...
Nom: facebook.png
Type: image/png
Taille: 956 octets
Desc: non disponible
URL: <http://lists.tranquil.it/pipermail/wapt/attachments/20160225/7c6f9994/attachment-0011.png>
-------------- section suivante --------------
Une pi?ce jointe autre que texte a ?t? nettoy?e...
Nom: spacer.gif
Type: image/gif
Taille: 1097 octets
Desc: non disponible
URL: <http://lists.tranquil.it/pipermail/wapt/attachments/20160225/7c6f9994/attachment-0003.gif>
-------------- section suivante --------------
Une pi?ce jointe autre que texte a ?t? nettoy?e...
Nom: googleplus.png
Type: image/png
Taille: 1527 octets
Desc: non disponible
URL: <http://lists.tranquil.it/pipermail/wapt/attachments/20160225/7c6f9994/attachment-0012.png>
-------------- section suivante --------------
Une pi?ce jointe autre que texte a ?t? nettoy?e...
Nom: spacer.gif
Type: image/gif
Taille: 1097 octets
Desc: non disponible
URL: <http://lists.tranquil.it/pipermail/wapt/attachments/20160225/7c6f9994/attachment-0004.gif>
-------------- section suivante --------------
Une pi?ce jointe autre que texte a ?t? nettoy?e...
Nom: linkedin.png
Type: image/png
Taille: 1141 octets
Desc: non disponible
URL: <http://lists.tranquil.it/pipermail/wapt/attachments/20160225/7c6f9994/attachment-0013.png>
-------------- section suivante --------------
Une pi?ce jointe autre que texte a ?t? nettoy?e...
Nom: maps.png
Type: image/png
Taille: 2548 octets
Desc: non disponible
URL: <http://lists.tranquil.it/pipermail/wapt/attachments/20160225/7c6f9994/attachment-0014.png>
-------------- section suivante --------------
Une pi?ce jointe autre que texte a ?t? nettoy?e...
Nom: non disponible
Type: image/png
Taille: 8867 octets
Desc: non disponible
URL: <http://lists.tranquil.it/pipermail/wapt/attachments/20160225/7c6f9994/attachment-0015.png>
-------------- section suivante --------------
Une pi?ce jointe autre que texte a ?t? nettoy?e...
Nom: non disponible
Type: image/png
Taille: 956 octets
Desc: non disponible
URL: <http://lists.tranquil.it/pipermail/wapt/attachments/20160225/7c6f9994/attachment-0016.png>
-------------- section suivante --------------
Une pi?ce jointe autre que texte a ?t? nettoy?e...
Nom: non disponible
Type: image/gif
Taille: 1097 octets
Desc: non disponible
URL: <http://lists.tranquil.it/pipermail/wapt/attachments/20160225/7c6f9994/attachment-0005.gif>
-------------- section suivante --------------
Une pi?ce jointe autre que texte a ?t? nettoy?e...
Nom: non disponible
Type: image/png
Taille: 1527 octets
Desc: non disponible
URL: <http://lists.tranquil.it/pipermail/wapt/attachments/20160225/7c6f9994/attachment-0017.png>
-------------- section suivante --------------
Une pi?ce jointe autre que texte a ?t? nettoy?e...
Nom: non disponible
Type: image/png
Taille: 1141 octets
Desc: non disponible
URL: <http://lists.tranquil.it/pipermail/wapt/attachments/20160225/7c6f9994/attachment-0018.png>
-------------- section suivante --------------
Une pi?ce jointe autre que texte a ?t? nettoy?e...
Nom: non disponible
Type: image/png
Taille: 2548 octets
Desc: non disponible
URL: <http://lists.tranquil.it/pipermail/wapt/attachments/20160225/7c6f9994/attachment-0019.png>
More information about the WAPT
mailing list