# Duplicated WAN Creation

**URL:** <https://forum.genieacs.com/t/duplicated-wan-creation/7250>\
**Category:** Help\
**Created:** [December 3, 2025, 8:41pm UTC](https://forum.genieacs.com/t/duplicated-wan-creation/7250 "2025-12-03T20:41:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![elanderson](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/elanderson/32/1579_2.png) [@elanderson](https://forum.genieacs.com/u/elanderson)\
**Post date:** [December 3, 2025, 8:41pm UTC](https://forum.genieacs.com/t/duplicated-wan-creation/7250/1 "2025-12-03T20:41:15Z")

</div>

Hi! Hope it finds you well.

It’s been basically 2 years since we first implemented GenieACS, and in the last month we opened around 70 Service Orders for customers claiming not having internet.

The thing is, once we access their router, there are 2 PPPoE Wan created, check it out:

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/genieacs/original/2X/5/586b44b462c38336660c364d0ab65e7a748d023e.jpeg)

At first i thought on some missconfigured settings on provision, but after spending all day trying to reproduce this on production i couldn’t find any problem on the script itself.

Does anyone here could notice if our configuring script has any interaction that could lead to this kinda of error? Creating another PPPoE i say.

The only thing i thought of was if the technician created a 3rd wan manually, then, the filter on checkWAN() wouldn’t work i guess, but even if it happens, the following line should keep only 1 instance of PPP Wan, right?

```javascript
declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*`, null, { path: 1 });

```

Check the full script:

```javascript
// Auditoria das ONTs\\

const now = Date.now();
const provisionado = declare("Tags.Provisionado", { value: 1 })?.value?.[0];
const bootstrap = args[0];
log(`provisionado: ${provisionado} || bootstrap: ${bootstrap}`);

if (provisionado && !bootstrap) {
  bindLANToWAN();
  log("CPE está (supostamente) configurada, retornando...");
  return;
}

const serial = declare('DeviceID.SerialNumber', { value: 1 }).value[0];
const productClass = declare('DeviceID.ProductClass', { value: 1 }).value[0];
const pppoe = ext("cpe-config", "GetPPPoE", serial);

declareBasicDevices();

log("[1]");
refreshWlan();
log("[2]");
checkWAN();
log("[3]");
setupAdditionalConfigs();
updateTags();

log('>> Reiniciando CPE para finalizar configuração...');
declare("Reboot", null, { value: now });

function updateTags() {
  declare("Tags.Provisionado", null, { value: true });
}

function refreshWlan() {
  log('>> Refreshing WLAN...');
  declareWLANConfiguration(1);
  declareWLANConfiguration(5);
}

function checkWAN() {
  declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*", { value: now });
  const wanNames = [1, 2, 3].map(getWANName);

  if (!wanNames[0] && !wanNames[1] && !wanNames[2]) {
    setupBaseWanPppConnection(true, 1);
  } else {
    for (let i = 0; i < wanNames.length; i++) {
      if (wanNames[i] && wanNames[i].includes("internet")) {
        setupBaseWanPppConnection(false, i + 1);
        break;
      }
    }
  }
}

function getWANName(connectionDeviceNumber) {
  const name = declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${connectionDeviceNumber}.WANPPPConnection.1.Name`, { value: now })?.value?.[0];
  return name ? name.toLowerCase() : null;
}

function setupBaseWanPppConnection(createWan, WANConnectionDevicePATH) {
  if (createWan) {
    if (productClass.includes('EN8255X6s-8X')) {
      declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.*`, null, { path: 1 });
    } else {
      declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*`, null, { path: 1 });
    }
  } 
  declareWanPppConnection(WANConnectionDevicePATH, pppoe.username, pppoe.password);
  huaweiOntX6AdditionalConfigs(WANConnectionDevicePATH);
}

function declareWanPppConnection(WANConnectionDevicePATH, username, password) {
  log('>> Atualizando valores WANPPP Base...');
  
  declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.Enable`, { value: now }, { value: true });
  declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.MaxMTUSize`, { value: now }, { value: "1492" });
  declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.MaxMRUSize`, { value: now }, { value: "1492" });
  declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.CurrentMRUSize`, { value: now }, { value: "1492" });
  declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.DNSEnabled`, { value: now }, { value: true });
  declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.NATEnabled`, { value: now }, { value: true });
  declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.DNSServers`, { value: now });
  declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.Username`, { value: now }, { value: username });
  declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.Password`, { value: now }, { value: password });
}

function huaweiOntX6AdditionalConfigs(WANConnectionDevicePATH) {
  declare(`InternetGatewayDevice.WANDevice.1.WANCommonInterfaceConfig.EnabledForInternet`, { value: now }, { value: true });
  declare(`InternetGatewayDevice.WANDevice.1.WANCommonInterfaceConfig.WANAccessType`, { value: now }, { value: "Ethernet" });
  declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.X_HW_VLAN`, { value: now }, { value: 10 });
  declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.X_HW_NatType`, { value: now }, { value: 0 });
  declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.X_HW_IPv6Enable`, { value: now }, { value: true });
  declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.X_HW_IPv6.IPv6Address.[]`, { value: now }, { path: 0 });
  declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.X_HW_IPv6.IPv6Prefix.[]`, { value: now }, { path: 0 });
  declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.X_HW_IPv6.IPv6Address.[]`, { value: now }, { path: 1 });
  declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.X_HW_IPv6.IPv6Address.1.Origin`, { value: now }, { value: "AutoConfigured" });
  declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.X_HW_IPv6.IPv6Prefix.[]`, { value: now }, { path: 1 });
  declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.X_HW_IPv6.IPv6Prefix.1.Origin`, { value: now }, { value: "PrefixDelegation" });
  declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.X_HW_LANBIND.*`, { value: now });
  declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.X_HW_LANBIND.SSID1Enable`, { value: now }, { value: 1 });
  declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.X_HW_LANBIND.SSID5Enable`, { value: now }, { value: 1 });
}

function setupAdditionalConfigs() {
  log('>> Finalizando configurações adicionais...');

  declare("InternetGatewayDevice.X_HW_MainUPnP.Enable", { value: now }, { value: true });
  declare("InternetGatewayDevice.X_HW_SlvUPnP.Enable", { value: now }, { value: true });
  declare("InternetGatewayDevice.X_HW_Security.*", { value: now });
  declare("InternetGatewayDevice.X_HW_Security.*.*", { value: now });
  declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl", { value: now });
  declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl.*", { value: now });
  declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl.AccessControlListEnable", { value: now }, { value: true });
  declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl.AccessControlListNumberOfEntries", { value: now }, { value: 1 });
  declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl.List", { value: now });
  declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl.List.*", null, { path: 1 });
  declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl.List.*.*", { value: now });
  declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl.List.*.Mode", { value: now }, { value: 0 });
  declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl.List.*.Priority", { value: now }, { value: 1 });
  declare("InternetGatewayDevice.X_HW_Security.AclServices.HTTPLanEnable", { value: now }, { value: true });
  declare("InternetGatewayDevice.X_HW_Security.AclServices.HTTPSLanEnable", { value: now }, { value: true });
  declare("InternetGatewayDevice.X_HW_Security.AclServices.SamBaLanEnable", { value: now }, { value: true });
  declare("InternetGatewayDevice.X_HW_Security.AclServices.WanAccess", { value: now });
  declare("InternetGatewayDevice.X_HW_Security.AclServices.WanAccess.*", null, { path: 1 });
  declare("InternetGatewayDevice.X_HW_Security.AclServices.WanAccess.*", { value: now });
  declare("InternetGatewayDevice.X_HW_Security.AclServices.WanAccess.*.*", { value: now });
  declare("InternetGatewayDevice.X_HW_Security.AclServices.WanAccess.1.Enable", { value: now }, { value: 1 });
  declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl.List.*.ServicePort", { value: now }, { value: "HTTP,ICMP" });
  declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl.List.*.SrcIp", { value: now }, { value: "XXXXXX" });
  declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl.List.*.SrcPortName", { value: now }, { value: "ALL" });
  declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl.List.*.SrcPortType", { value: now }, { value: 2 });
  declare("InternetGatewayDevice.X_HW_AppRemoteManage.CurrentMgtURL", { value: now }, { value: "XXXXXXXX" });
  declare("InternetGatewayDevice.X_HW_AppRemoteManage.CurrentPort", { value: now }, { value: "00000" });
  declare("InternetGatewayDevice.X_HW_AppRemoteManage.PhoneAppURL", { value: now }, { value: "XXXXXXX" });
  declare("InternetGatewayDevice.LANDevice.*", { value: now });
  //declare("InternetGatewayDevice.LANDevice.1.LANEthernetInterfaceConfig.*", null, { path: 4 });
  declare("InternetGatewayDevice.LANDevice.1.LANEthernetInterfaceConfig.*.X_HW_L3Enable", { value: now }, { value: true });
  declare("InternetGatewayDevice.Time.*", { value: now });
  declare("InternetGatewayDevice.Time.Enable", { value: now }, { value: true });
  declare("InternetGatewayDevice.Time.LocalTimeZone", { value: now }, { value: "-03:00" });
  declare("InternetGatewayDevice.Time.LocalTimeZoneName", { value: now }, { value: "Brasilia" });
  declare("InternetGatewayDevice.Time.NTPServer1", { value: now }, { value: "clock.fmt.he.net" });
  declare("InternetGatewayDevice.Time.NTPServer2", { value: now }, { value: "time.windows.com" });
  declare("InternetGatewayDevice.Time.X_HW_SynInterval", { value: now }, { value: "3600" });
  declare("InternetGatewayDevice.X_HW_Security.Firewall.Enable", { value: now }, { value: true });

  const ont = ext("cpe-config", "GetONTPassword", pppoe.username);
  declare("InternetGatewayDevice.UserInterface.X_HW_WebUserInfo.*", { value: now });
  declare("InternetGatewayDevice.UserInterface.X_HW_WebUserInfo.*.*", { value: now });
  declare("InternetGatewayDevice.UserInterface.X_HW_WebUserInfo.*.Enable", { value: now }, { value: true });
  declare("InternetGatewayDevice.UserInterface.X_HW_WebUserInfo.2.Password", { value: 1 }, { value: ont.password });
}

function declareBasicDevices() {
  declare("InternetGatewayDevice", { value: now });
  declare("InternetGatewayDevice.*", { value: now });
  declare("InternetGatewayDevice.WANDevice.*", { value: now });
  declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*", { value: now });
}

function bindLANToWAN() {
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.*.WANPPPConnection.1.X_HW_LANBIND.Lan1Enable", { value: now }, { value: 1 });
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.*.WANPPPConnection.1.X_HW_LANBIND.Lan2Enable", { value: now }, { value: 1 });
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.*.WANPPPConnection.1.X_HW_LANBIND.Lan3Enable", { value: now }, { value: 1 });
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.*.WANPPPConnection.1.X_HW_LANBIND.Lan4Enable", { value: now }, { value: 1 });
  //declare("InternetGatewayDevice.Layer3Forwarding.X_HW_policy_route.2.PhyPortName", { value: now }, { value: "LAN1,LAN2,LAN3,LAN4,SSID1,SSID5" });
  declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl.List.*.ServicePort", { value: now }, { value: "HTTP,ICMP" });
}

function declareWLANConfiguration(configNumber) {
  declare(`InternetGatewayDevice.LANDevice.1.WLANConfiguration.${configNumber}.*`, { value: now });
  declare(`InternetGatewayDevice.LANDevice.1.WLANConfiguration.${configNumber}.Enable`, { value: now }, { value: true });
  declare(`InternetGatewayDevice.LANDevice.1.WLANConfiguration.${configNumber}.X_HW_AttachConf.X_HW_AirtimeFairness`, { value: now }, { value: true });
}

```

Thank you so much for the attention

---

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [December 3, 2025, 10:28pm UTC](https://forum.genieacs.com/t/duplicated-wan-creation/7250/2 "2025-12-03T22:28:33Z")

</div>

Your syntax is incorrect.

Here is a corrected version of one of your functions.

```javascript
function declareWanPppConnection(WANConnectionDevicePATH, username, password) {
    log('>> Atualizando valores WANPPP Base...');
    
    const basePath = `InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection`;
    const params = {
        Name: '2_INTERNET_R_VID_10', // Or what ever you want to call it
        Enable: true,
        MaxMTUSize: 1492,
        MaxMRUSize: 1492,
        CurrentMRUSize: 1492,
        DNSEnabled: true,
        NATEnabled: true,
        Username: username,
        Password: password,
    };
    
    // Delete all existing PPP entries
    declare(basePath + '.[]', null, {path: 0});

    // Add back in the only one we allow
    const path = basePath + '.[' + Object.keys(params).map(key => key + ':' + params[key]).join(',') + ']';
    declare(path, {path: 1}, {path: 1});
}

```

---

<div class="post-metadata">

**Author:** ![elanderson](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/elanderson/32/1579_2.png) [@elanderson](https://forum.genieacs.com/u/elanderson)\
**Post date:** [December 4, 2025, 12:23pm UTC](https://forum.genieacs.com/t/duplicated-wan-creation/7250/3 "2025-12-04T12:23:07Z")

</div>

Thank you so much once again, Dan!

We’ll implement it here and see if it’s gonna fix our problem (probably will). Are there any other recommendations?

---

<div class="post-metadata">

**Author:** ![elanderson](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/elanderson/32/1579_2.png) [@elanderson](https://forum.genieacs.com/u/elanderson)\
**Post date:** [December 4, 2025, 1:17pm UTC](https://forum.genieacs.com/t/duplicated-wan-creation/7250/4 "2025-12-04T13:17:38Z")

</div>

Just tried applying it, but this kept happening. Instead of deleting both wanPPP it kept deleting and adding until RPC too may requests crashed the running of the script and not finishing everything, like binding internet to LAN and WLAN, remote management, etc.

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/genieacs/original/2X/7/70525c0ecd2f6bc1e586252ae16fec51f83ccf3e.png)

Why is it happening?

---

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [December 4, 2025, 4:52pm UTC](https://forum.genieacs.com/t/duplicated-wan-creation/7250/5 "2025-12-04T16:52:24Z")

</div>

Re-read the output. Then [enable debug](https://forum.genieacs.com/t/how-to-enable-debug/5728/3) and try again and review the output in the debug yaml file.
