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

    Apply IP addresses changes from PHP shell

    Scheduled Pinned Locked Moved General pfSense Questions
    2 Posts 2 Posters 600 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.
    • S
      sparkvilla
      last edited by

      Hi all. I am trying to change the IP addresses of my lan interface and accordingly also the dhcpd range from the PHP shell. I type:

      $config['interfaces']['lan']['ipaddr'] = "10.20.0.1";
      $config['dhcpd']['lan']['range']['from'] = "10.20.0.65";
      $config['dhcpd']['lan']['range']['to'] = "10.20.0.164";
      write_config();

      To actually see the changes to take effect I need to reboot the pfSense. Is there a command in the PHP shell to apply the changes without rebooting?

      Thanks

      1 Reply Last reply Reply Quote 0
      • D
        David_W
        last edited by

        Using interface_bring_down() followed by interface_configure() on the interface will change the IP addresses of the interface, but there's so much mopping up to do afterwards that a reboot is really your only option. pfSense was not designed to be reconfigured from a command line interface.

        If you're curious, look at the if ($_POST['apply']) { } block of /usr/local/www/interfaces.php (line 441 onwards in 2.3).

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