This commit is contained in:
2021-11-30 17:34:56 -05:00
parent 0147c30be3
commit acc3d308e5

View File

@@ -118,6 +118,8 @@ printf("Setting WAN to Static based on the DHCP information. \n");
$config['interfaces'][$wanInterface]['ipaddr'] = $wanStaticIP;
$config['interfaces'][$wanInterface]['subnet'] = $wanStaticIPSubnet;
$config['interfaces'][$wanInterface]['gateway'] = $gatewayName;
# setup gateway
$gwCount = count($config['gateways']['gateway_item']);
$config['gateways']['gateway_item'][$gwCount]['gateway'] = $gatewayIP;
$config['gateways']['gateway_item'][$gwCount]['interface'] = $interface;
@@ -127,13 +129,14 @@ $config['gateways']['gateway_item'][$gwCount]['monitor_disable'] = 1;
$config['gateways']['gateway_item'][$gwCount]['defaultgw'] = 1;
$config['gateways']['gateway_item'][$gwCount]['fargw'] = 1;
# Loop through outbound nat
# Loop through outbound nat and update the wan ip
foreach ($config['nat']['outbound']['rule'] as $i => $rule) {
if ($rule['interface'] == $wanInterface ) {
$config['nat']['outbound']['rule'][$i]['target'] = $wanIP;
}
}
# loop through carp addresses and update the wan ip address
foreach ($config['virtualip']['vip'] as $i => $vip) {
if ($vip['interface'] == $wanInterface) {
$config['virtualip']['vip'][$i]['subnet_bits'] = $wanSubnet;
@@ -153,10 +156,12 @@ filter_configure_sync(true);
webgui_configure_do(true);
rrd_configure(true);
printf("Done Setting WAN to Static based on the DHCP information. \n");
printf("Sleeping for 30 seconds. \n");
sleep(30);
# try to sync carp settings to backup node/router
printf("Starting the CARP Sync. \n");
$syncStatus = trim(shell_exec('configctl system ha_reconfigure_backup'));
printf("CARP Sync Status: %s. \n", $syncStatus);