Apply IP addresses changes from PHP shell
-
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
-
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).