Restart pfsense remotely? from anther machine
Is there a way to send commands to a pfsense box to reboot it from another machine? say another linux machine?
Via ssh - yes. You can always connect some user via SSH and simply run a
if you have the sudo package installed. (recommended)
I'd not advise to connect automatically via "root" and use a SSH key for the connection if you want to automize that.
Is there a special reason you want to remote-restart pfSense?
OK, sounds like I need to do the SSH key
Because sometimes the wan interface fails to get an IP from the modem so i need a restart
I’m thinking if your WAN interface isn’t getting an IP address, you’re not going to be able to get in remotely to do a reboot... am I right?
Really hacky but theoretically you could write a script and run it as a cron job every 10 seconds or something that checks if the WAN has an IP or not and either restarts the DHCP service or just reboots the system (YOLO)
Its run from the LAN side, not the WAN side.
@automate Alright so if you're in range of the pfSense then you can setup an AP on the LAN side. Or just physically connected a cable via switch or direct LAN port.
Really you should not be doing that. It shouldn't fail to get an IP via DHCP but even if it does you should not need to reboot to get one. Re-running the dhcp client or down/up-ing the interface should brinh it back.
Some tests you can do there are to just unplug and replig the WAN cable, does that allow it to pull an IP?
Or reboot the modem, does that correct it.
What error logs do you see? What does the WAN interface look like in
ifconfigwhen it fails.
I would also investigate the root cause of the problem (DHCP) instead of the reboot workaround.
Previously i also had a problem with DHCP as i would randomly not receive an IP from my ISP (via cable modem).
I phoned my ISP and he disabled CG-NAT ( carrier grade NAT ). Not sure how & why, but DHCP worked fine after that....
Im happy to down the WAN/restart dhcp but it needs to be via command line , the intention is to link the command into a home automation system so the user (non technical) can press a button in the UI to restart the box, or dhcp
jahonix last edited by
OpenHab for this project
Any ideas guys??
Maybe check this script. I'm not sure if this will work for you, but it might give you some ideas for solution.
@tomashk fantastic! i think this will do it.
Ive installed it so ill see how that goes, appreciated.
NollipfSense last edited by