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

    Interface Timer Suggestion?

    Scheduled Pinned Locked Moved General pfSense Questions
    12 Posts 3 Posters 1.2k Views 3 Watching
    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.
    • JKnottJ Offline
      JKnott @deanfourie
      last edited by

      @deanfourie

      That should be easy enough to do with shell scripts.

      PfSense running on Qotom mini PC
      i5 CPU, 4 GB memory, 32 GB SSD & 4 Intel Gb Ethernet ports.
      UniFi AC-Lite access point

      I haven't lost my mind. It's around here...somewhere...

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

        You could probably achieve that by setting ppp to9 dial-on-demand and using a scheduled firewall rule to prevent demand whenever you don't want/need it.

        Steve

        1 Reply Last reply Reply Quote 0
        • D Offline
          deanfourie
          last edited by

          Thanks guys, I should point out that im using a ethernet upstream gateway which is my internet gateway, which is the 4G router and does not support bridge mode.

          Not sure if this makes a difference.

          JKnottJ 1 Reply Last reply Reply Quote 0
          • JKnottJ Offline
            JKnott @deanfourie
            last edited by

            @deanfourie

            One other possibility is to get an ordinary timer and a 5 port switch. Place the switch between pfsense and your connection and have the timer turn it on & off as needed.

            PfSense running on Qotom mini PC
            i5 CPU, 4 GB memory, 32 GB SSD & 4 Intel Gb Ethernet ports.
            UniFi AC-Lite access point

            I haven't lost my mind. It's around here...somewhere...

            D 1 Reply Last reply Reply Quote 0
            • D Offline
              deanfourie @JKnott
              last edited by

              @jknott yea I did think of this, more of a AC power timer plug or something, would be much easier and cleaner if I could control the actual interface itself.

              JKnottJ 1 Reply Last reply Reply Quote 0
              • JKnottJ Offline
                JKnott @deanfourie
                last edited by

                @deanfourie

                As I mentioned, shell scripts will do it. I haven't done much with scripts on BSD, but I have on Linux. You can have a script run at the appropriate time and use the ifconfig command to enable or disable the interface.

                PfSense running on Qotom mini PC
                i5 CPU, 4 GB memory, 32 GB SSD & 4 Intel Gb Ethernet ports.
                UniFi AC-Lite access point

                I haven't lost my mind. It's around here...somewhere...

                D 1 Reply Last reply Reply Quote 0
                • D Offline
                  deanfourie @JKnott
                  last edited by

                  @jknott great thanks for the reply.

                  So using the Cron plugin, I would just issue commands as I would in Linux? Do they need to be run as root?

                  So a Cron job to run at desired time/interval

                  ifconfig ue0 down

                  Can I also issue other commands like this such as reboot and shutdown 0 etc?

                  Thanks

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

                    Yes, no and yes!

                    Just make sure to use the full path to the command. The user Cron runs as does not have the same paths as admin/root.

                    Personally I would look at using scheduled firewall rules and dial on demand though. It's a 'cleaner' solution if it works for you. All contained in the main config.

                    Steve

                    D 1 Reply Last reply Reply Quote 0
                    • D Offline
                      deanfourie @stephenw10
                      last edited by

                      @stephenw10 Ok I have tested the commands in the command prompt, entered the commands and executed them and they worked fine. Tested

                      ifconfig ue0 down
                      ifconfig ue0 up
                      reboot

                      all commands worked fine in command prompt, should I still use relative paths in cron?

                      Ideally, would like to figure out why pfSense keeps crashing.

                      Thanks

                      JKnottJ 1 Reply Last reply Reply Quote 0
                      • JKnottJ Offline
                        JKnott @deanfourie
                        last edited by

                        @deanfourie

                        Cron is the usual method for time related activities. It runs as root and use the full path from /.

                        PfSense running on Qotom mini PC
                        i5 CPU, 4 GB memory, 32 GB SSD & 4 Intel Gb Ethernet ports.
                        UniFi AC-Lite access point

                        I haven't lost my mind. It's around here...somewhere...

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

                          @deanfourie said in Interface Timer Suggestion?:

                          should I still use relative paths in cron?

                          Yes, use the full path. That's the most common reason custom cron jobs fail. The cron user does not have the same paths as root which is what the command prompt runs as.

                          Steve

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