Description:

You can use this script to create a port forwarding.

List of used variables:

VariableDescription




Add-in code:

/**
 * @param {Config} config
 * @param {Context} context
 * Do not edit this comment or parameter types. Required for code suggestions
*/
exports.main = function (config, context) {



    // Required variables:
    // CustomTag  = string
    // CustomIP   = string
    // CustomPort = string

    // /Setup/IP-Router/1-N-NAT/Service-Table
    var serviceTable = config.getTableByOid( "1.2.8.9.4" );
    var myRow = serviceTable.createNewRow();
    myRow.setByOid( "1" , context.vars. CustomPort );   //D-port-from
    myRow.setByOid( "5" , "0" );                       //Active (No (1), Yes (0))
    myRow.setByOid( "3" , context.vars. CustomPort );   //D-port-to
    myRow.setByOid( "7" , "MANAGEMENT" );             //Peer
    myRow.setByOid( "2" , context.vars. CustomIP );     //Intranet-Address
    myRow.setByOid( "4" , "443" );                     //Map-Port
    myRow.setByOid( "8" , "0" );                       //Protocol (TCP (1), UDP (2), TCP+UDP (0))
    myRow.setByOid( "9" , "0.0.0.0" );                 //WAN-Address
    myRow.setByOid( "6" , "" );                       //Comment
    serviceTable.addOrMerge(myRow);

};

Add-in as JSON file:

port_forwarding.json