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

Inconsistency with PHP shell & committing changes

Scheduled Pinned Locked Moved Development
1 Posts 1 Posters 216 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.
  • W
    WvdW
    last edited by Sep 21, 2023, 8:11 AM

    Hi,

    I am trying to reassign interfaces through the PHP shell and to created VLANs instead of the underlying NICs.

    Version: 2.7.0

    It is a new installation with the default settings.
    Running the php shell from the console I execute the following instructions:
    $config['interfaces']['wan']['descr'] = "WAN";
    $config['interfaces']['wan']['enable'] = true;
    $config['interfaces']['wan']['if'] = "igb0.507";
    $config['interfaces']['wan']['ipaddr'] = "x.x.x.x";
    $config['interfaces']['wan']['subnet'] = "xx";
    $config['interfaces']['wan']['gateway'] = "WAN_GW01";
    $config['interfaces']['wan']['blockpriv'] = true;
    $config['interfaces']['wan']['blockbogons'] = true;
    $config['interfaces']['lan']['descr'] = "LAN";
    $config['interfaces']['lan']['enable'] = true;
    $config['interfaces']['lan']['if'] = "igb1.3004";
    $config['interfaces']['lan']['ipaddr'] = "192.168.1.1";
    $config['interfaces']['lan']['subnet'] = "24";
    $config['interfaces']['opt1']['descr'] = "LAN2";
    $config['interfaces']['opt1']['enable'] = true;
    $config['interfaces']['opt1']['if'] = "igb1.3006";
    $config['interfaces']['opt1']['ipaddr'] = "10.2.0.1";
    $config['interfaces']['opt1']['subnet'] = "16";
    $config['interfaces']['opt2']['descr'] = "LAN3";
    $config['interfaces']['opt2']['enable'] = true;
    $config['interfaces']['opt2']['if'] = "igb1.3007";
    $config['interfaces']['opt2']['ipaddr'] = "172.16.0.1";
    $config['interfaces']['opt2']['subnet'] = "16";
    write_config();
    exec;

    Findings:

    • If I query the interfaces in the shell immediately after running the above it shows as correctly assigned to the VLANs
    • I can ping and be pinged on the various networks
    • When I reboot everything comes back up as assigned except the wan and lan networks. They revert back to the original if assignments (igb0 and igb1 instead of igb0.507 and igb1.3004). Opt1 & 2 retain their settings.

    I then tried the same instructions but ended with:
    write_config();
    ! rm /tmp/config.cache
    exec;

    With the same end results.

    The last option I tried was:
    write_config();
    ! rm /tmp/config.cache
    system_reboot_sync();
    exec;

    Again with the same results.

    I was able to do this with 2.6.0 using version 1 of the script without a problem.
    Has something in 2.7.0 changed that must be included to force a permanent commit across all the interfaces?

    Thanks.

    Werner

    1 Reply Last reply Reply Quote 0
    1 out of 1
    • First post
      1/1
      Last post
    Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
      This community forum collects and processes your personal information.
      consent.not_received