Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Restart pfsense remotely? from anther machine

    Scheduled Pinned Locked Moved Hardware
    16 Posts 9 Posters 5.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • JeGrJ
      JeGr LAYER 8 Moderator
      last edited by

      Via ssh - yes. You can always connect some user via SSH and simply run a

      sudo reboot 
      

      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?

      Don't forget to upvote 👍 those who kindly offered their time and brainpower to help you!

      If you're interested, I'm available to discuss details of German-speaking paid support (for companies) if needed.

      1 Reply Last reply Reply Quote 0
      • A
        automate
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • A
          akuma1x
          last edited by akuma1x

          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?

          Jeff

          1 Reply Last reply Reply Quote 0
          • S
            swarm
            last edited by

            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)

            1 Reply Last reply Reply Quote 0
            • A
              automate
              last edited by

              Its run from the LAN side, not the WAN side.

              S 1 Reply Last reply Reply Quote 0
              • S
                swarm @automate
                last edited by

                @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.

                1 Reply Last reply Reply Quote 0
                • stephenw10S
                  stephenw10 Netgate Administrator
                  last edited by

                  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 ifconfig when it fails.

                  Steve

                  1 Reply Last reply Reply Quote 0
                  • G
                    gcu_greyarea
                    last edited by

                    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....

                    1 Reply Last reply Reply Quote 0
                    • A
                      automate
                      last edited by

                      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

                      jahonixJ 1 Reply Last reply Reply Quote 0
                      • jahonixJ
                        jahonix @automate
                        last edited by

                        @automate said in Restart pfsense remotely? from anther machine:

                        command into a home automation system

                        Which HA system do you use?
                        You're ACE/CAIP/CSP/EQIP?

                        1 Reply Last reply Reply Quote 0
                        • A
                          automate
                          last edited by

                          OpenHab for this project

                          1 Reply Last reply Reply Quote 0
                          • A
                            automate
                            last edited by

                            Any ideas guys??

                            1 Reply Last reply Reply Quote 0
                            • T
                              tomashk
                              last edited by

                              Maybe check this script. I'm not sure if this will work for you, but it might give you some ideas for solution.
                              https://forum.netgate.com/topic/127403/auto-renew-dhcp-after-outage/23

                              A 1 Reply Last reply Reply Quote 0
                              • A
                                automate @tomashk
                                last edited by

                                @tomashk fantastic! i think this will do it.

                                Ive installed it so ill see how that goes, appreciated.

                                1 Reply Last reply Reply Quote 0
                                • NollipfSenseN
                                  NollipfSense
                                  last edited by

                                  You could use this: https://www.ebay.com/itm/MSNSwitch-Internet-Enabled-IP-Remote-Power-Switch-with-Reboot/392301437447?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2060353.m1438.l2649

                                  pfSense+ 23.09 Lenovo Thinkcentre M93P SFF Quadcore i7 dual Raid-ZFS 128GB-SSD 32GB-RAM PCI-Intel i350-t4 NIC, -Intel QAT 8950.
                                  pfSense+ 23.09 VM-Proxmox, Dell Precision Xeon-W2155 Nvme 500GB-ZFS 128GB-RAM PCIe-Intel i350-t4, Intel QAT-8950, P-cloud.

                                  1 Reply Last reply Reply Quote 0
                                  • First post
                                    Last post
                                  Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.