wake-on-lan
-
i was able to setup my eaton 9135 5kva ups using snmp.
pfsense can pull all the information, no issues.ive got all my servers setup as to pull info from the ups. certain servers will shut down immediately apon battery to prolong the battery life for other servers. then the other servers will shutdown when the battery level is low.
if the ups never dies then the servers will never reboot.
is there a way to have pfsense send a wake-on-lan command once power has been restored to the ups automatically?
-
Sure.
Install
Add a command :
where 192.168.1.2 is the IPv4 of the device and MAC is the MAC.
Easy to test :
Shut down your device 192.168.1.2
Open a pfSense console - option 8.
Execute the command, the server will wake up.
Now you know the command is ok, copy paste into a Startcmd entry in the GUI.
Extra test : shut down the 192.168.1.2
Shut down pfSense.
Start pfSense : the server should start also. -
@chipbreak said in wake-on-lan:
is there a way to have pfsense send a wake-on-lan command once power has been restored to the ups automatically?
No, you would have to code something up for this.
-
@dennypage is this something that can be coded on shellcmd or would i need be better off setting up a raspberry pie to code something for this?
-
@chipbreak I would think you can do it with scripting from cron.
-
@chipbreak said in wake-on-lan:
can be coded on shellcmd
Coded ?
Executing a command is coding now ?Whats wrong / not clear with the solution posted above ?
-
@Gertjan said in wake-on-lan:
Whats wrong / not clear with the solution posted above ?
What you posted would work, but is a manual solution. OP asked about an automated solution:
@chipbreak said in wake-on-lan:
is there a way to have pfsense send a wake-on-lan command once power has been restored to the ups automatically?
Automation requires coding/scripting.
-
@dennypage this would only work if pfsense turns off due to the ups running out of battery charge. All my systems are set to turn on with the return of power. the issue I'm having is when the power goes out my system initiate shut down but my ups never dies. Now I have to manually turn the system back on.
I believe the easiest way to code this would be to send a wake on lan signal every 5mins if the ups is sending a charging signal.
Edit: when I say systems Im specifically referring to my hypervisor and nas not pfsense.
-
@chipbreak said in wake-on-lan:
I believe the easiest way to code this would be to send a wake on lan signal every 5mins if the ups is sending a charging signal.
Has also been solved in the sixties (last century).
The solution is nearly identical : install the pfSense cron package.
Now you can create a cron task that executes every x minutes the wol command I've shown above.
wol wakeup packets are very small (3 times the MAC size + Ethernet packet header) so you won't 'feel' the network load.Or : why note, you automate it the more intelligent way : a small shells script that pings the server(s). If it fails after several pings, it starts to execute the wol command. if that fails after x tries, a mail notification to tell you the server won't wake up.
In reality such a solution is used less often. People tend to look for a more stable power source / not hosting servers where the power goes out all the time. Like a data center, as this auto solves the issue without coding ^^ -
@chipbreak said in wake-on-lan:
I believe the easiest way to code this would be to send a wake on lan signal every 5mins if the ups is sending a charging signal.
Start with this command:
upsc myups ups.status
"OL" (On Line) would be the status on mains, but they are others that will appear, and are separated by comma. Important ones would be "OB" (On Battery), "LB" (Low Battery), "FSD" (Forced Shut Down).