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

    Developer Shell not changing WAN IP

    Scheduled Pinned Locked Moved General pfSense Questions
    2 Posts 2 Posters 570 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.
    • L Offline
      lordalex
      last edited by

      Hello,

      I'm using PFSense 2.1.5 (for compatibility reasons, it's in use in our datacenter) and we're trying to modify the WAN IP using the Developer Shell.

      The Script I use is this:

      
      $config['interfaces']['wan']['ipaddr'] = "192.168.130.111";
      $config['virtualip']['vip']['0']['subnet'] = "192.168.130.113";
      $config['gateways']['gateway_item']['0']['gateway'] = "192.168.130.113";
      write_config();
      exec
      
      

      When I execute it from the developer shell (#12 in option list) it DOES change the Virtual IP and the Gateway IP  but it does not change the WAN IP.

      I think that the config is modified because if in the WEB GUI I go to "Interfaces -> WAN" I see the new IP and I have to click "Save" then "Apply" to get it working.

      Also, if I reboot the pfsense (without "Saving & Applying") the new configuration is loaded successfully.

      Am I doing something wrong?

      Maybe I need to use the CLI (#8 in option)?

      Thanks for the support.

      1 Reply Last reply Reply Quote 0
      • F Offline
        fwcheck
        last edited by

        I didn't  find a way to reset the WAN-IP from the developershell without a reboot.
        If anyone knows i'd like to hear about a solution without a reboot.
        My developer-shell solution looks like this

        $config['interfaces']['wan']['disabled'] = false;
        $config['interfaces']['wan']['ipaddr'] = "<ip>";
        $config['interfaces']['wan']['subnet'] = "<subnet>";
        $config['gateways']['gateway_item'][0]['gateway'] = "<gw>";
        $config['gateways']['gateway_item'][0]['name'] = "GW_WAN";
        $config['gateways']['gateway_item'][0]['interface'] = "wan";
        $config['gateways']['gateway_item'][0]['monitor_disable'] = true;
        $config['gateways']['gateway_item'][0]['defaultgw'] = true;
        write_config();
        exec;
        system_reboot_sync();
        exec;</gw></subnet></ip>
        

        exit  <- Systems reboot, is not executed

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