Wake on lan from mac adresses from DHCP Lease



  • Hi,

    i'm a beginer with pfsense
    I would like to know if it's possible to take mac addresses from the DHCP lease and add them to the Wake on lan services automatically.

    maybe with a shell script ? or Cron Job ?

    i work in a school with laptops that we have to move every weeks to match the number of students ( different students every week ).

    each classroom is in a specific vlan.

    i would like to try with a shell script but i don't know how to, and where to take those mac adresses and where to put them.

    Thanks in advance.



  • Why want you do that?

    If your only intention is that you have the MACs in the WOL list you may as well go to Status > DHCP Leases, here you will find a wake-up button at the right under "Actions" for all MACs which got leases and are offline right now.
    Maybe you need to increase the DHCP maximum lease time.


  • Netgate Administrator

    I imagine wanting to wake all the laptops on a VLAN at once.

    There's no way to do that in pfSense so you would need to use a script of some sort. You could pull them from the ARP table or DHCP leases. Adding them to the config would be more tricky if you wanted to wake from the GUI. Might be easier to script that too.

    Steve


  • LAYER 8 Global Moderator

    @stephenw10 said in Wake on lan from mac adresses from DHCP Lease:

    I imagine wanting to wake all the laptops on a VLAN at once.

    I have the same question - when exactly are you wanting/needing to WOL these devices... And they are all "wired" laptops? Or they are wireless - which would make more sense for laptops... Do they support WOWLAN?

    If you would give more details of your setup, and what exactly is the issue your trying to overcome with the wol stuff we could discuss possible solutions to your dilemma



  • @johnpoz @stephenw10 @viragomann
    Thanks your for your replies

    "Why want you do that?"

    I work in a training center every monday i have to (without the wake on lan ) turn on every laptops so our inventory script (script on startup) can send information to our server inventory ( memory on hdd, ram, days being offline etc...) some students had already stolen someslaptops and because sometimes we have to upload some files on these computers for some reason (we rent our classroom when they are empty)
    My CEO ask for an inventory pretty often that’s why we do it like that.

    Since our laptops are for our trainees they are not in a domain, they are all « wired » and do not support wowlan.
    Our student are part time at work/school, so when a group is at work the other one are at school, the numbers of student changes every week so working with laptop is easier for us.
    We have 4 centers but have only 3 technicians + 1 admin (wich is always with a tech) so being able to use WOL when a tech isnt present is really helpfull.
    Until now i would take the mac addresses from the DHCP lease and put them manually in the WOL service, but since we move the laptops every week it takes a lot of time just doing that.
    Sorry for my english, it’s not my main language


  • LAYER 8 Global Moderator

    @pprasonexay said in Wake on lan from mac adresses from DHCP Lease:

    from the DHCP lease and put them manually in the WOL service

    You mean the simple click button to add it..

    I would throw out a suggestion... You want to wake all the boxes currently connected to the network right.. And you have a full inventory right.. Wouldn't it be easy to just get a "full" list of every laptop mac you have from your inventory.. And add it to some wol script you run... No big deal sending wol to devices that are not there ;)

    You could also just put all these details in a file from your inventory.. Then just run the wol command directly from pfsense with the -f option to use the details from this file.

    If you want them in the gui - you could export the wol xml via backup, then edit it to have all your devices mac in it then restore the xml.



  • @pprasonexay

    One question, do those laptops support WoL?



  • @pprasonexay said in Wake on lan from mac adresses from DHCP Lease:

    @johnpoz @stephenw10 @viragomann
    Thanks your for your replies
    I work in a training center every monday i have to (without the wake on lan ) turn on every laptops so our inventory script (script on startup) can send information to our server inventory...

    I don't think that any WOL command can actually "turn on" a computer, like you say.

    Jeff


  • LAYER 8 Global Moderator

    It can ;) And from the take of the posts - they are already doing it, just manually adding the devices to the wol list in pfsense.

    But yes the device your wanting to "wakeup" has to support wol and it has to be enabled ;)



  • @johnpoz Ok, my mistake. Sorry. I have simply not come across one yet that can do that. Or, actually needed to wake a powered off computer.

    Jeff



  • @akuma1x

    I have an IBM Netfinity server here that supports that. However my desktop computer that I had a few years ago didn't. I don't know about my current desktop, as I haven't checked. My ThinkPad E520 doesn't appear to. So, it all depends on the hardware, but you're more likely to find it in server grade gear than consumer level.


  • LAYER 8 Global Moderator

    WOL is pretty standard these days. Pretty much anything supports it.. Now WOWLAN is a different matter, which is why asked if wired or not, etc.

    But sounds like to me that its already working for the devices, and just wants an easy way to get the list... But since they have a full inventory of all devices they should already have the info they need... just send out the wol to all your macs... Only the ones on that layer 2 are going to answer, etc. Say that is 25 of 200.. its no big deal that your sending an extra 175 wol packets that nobody will answer too.

    example: your thinkpad e520
    https://support.lenovo.com/us/en/downloads/ds013949

    Enabling Wake on LAN from Standby for ENERGY STAR for Windows 10 (32-bit, 64-bit), 8.1 (32-bit, 64-bit), 8 (32-bit, 64-bit), 7 (32-bit, 64-bit), Vista (32-bit, 64-bit), XP (32-bit, 64-bit)

    Your E520 is listed, with pretty much every other box they have made ;)


  • Netgate Administrator

    @johnpoz said in Wake on lan from mac adresses from DHCP Lease:

    just send out the wol to all your macs... Only the ones on that layer 2 are going to answer

    This seems like a good call. I assume the scripts you have on each laptop then run when it boots and report in so you can see which devices are present.

    Steve



  • @johnpoz @JKnott @akuma1x

    I will try your suggestion, didn't think about doing that that way!


Log in to reply