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

    Changing settings via script

    Scheduled Pinned Locked Moved General pfSense Questions
    7 Posts 2 Posters 413 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.
    • M
      marciobacci
      last edited by

      I'm setting up a script that makes some changes to PFSense. Basically, I want to change the IPs of the interfaces so that they have a static configuration and I also want to change the password of the admin user.

      Is there any way to do this via shell script?

      Can someone help me?

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

        You can do a lot of things using a php shell script. 😉

        You want to reset the same IPs every time? Across multiple installs?

        Check the included php shell sessions in /etc/phpshellsessions for examples.

        Steve

        M 1 Reply Last reply Reply Quote 0
        • M
          marciobacci
          last edited by

          HI

          The idea is that when the machine is started, it will run the shell script to configure the network and the admin password. It will be just one PFSense machine and it is for a lab that I am setting up.

          The student will access the environment and when the lab is started, the PFSense should already be running with the fixed IP and the password already changed.

          1 Reply Last reply Reply Quote 0
          • M
            marciobacci @stephenw10
            last edited by

            @stephenw10

            The idea is that when the machine is started, it will run the shell script to configure the network and the admin password. It will be just one PFSense machine and it is for a lab that I am setting up.

            The student will access the environment and when the lab is started, the PFSense should already be running with the fixed IP and the password already changed.

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

              Is it a VM? You could just restore it to a known state.

              If it's a real device you could pull in a config at boot using the ECL:
              https://docs.netgate.com/pfsense/en/latest/backup/restore-during-install.html#restore-using-the-external-configuration-locator-ecl

              M 1 Reply Last reply Reply Quote 0
              • M
                marciobacci @stephenw10
                last edited by

                @stephenw10

                It's a cloud lab that I don't have access to.

                I just create the machine configuration scripts to be executed at startup, test them on my virtual machines and then send them to the person responsible for the cloud environment.

                All machines are loaded via script (shell script or powershell).

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

                  php shell script probably easiest then.

                  https://docs.netgate.com/pfsense/en/latest/development/php-shell.html

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