Description:

With the following Add-in script you can assign static IP addresses to VLAN(s) and activate the routing for the VLAN(s).

This example script uses 7 VLANs but you can modify it to any amount of VLANs you like.

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) {



    config.addScriptLine( "vlan database" ); // Activate routing for the respective VLAN, the last number is the internal enumeration of the existing VLANs (not absolutely necessary)

    config.addScriptLine( "vlan routing 1102 1" );
    config.addScriptLine( "vlan routing 1006 2" );
    config.addScriptLine( "vlan routing 10 3" );
    config.addScriptLine( "vlan routing 64 4" );
    config.addScriptLine( "vlan routing 80 5" );
    config.addScriptLine( "vlan routing 100 6" );
    config.addScriptLine( "vlan routing 1199 7" );
    config.addScriptLine( "exit" );


    config.addScriptLine( "configure" );
    config.addScriptLine( "ip routing" );

    config.addScriptLine( "interface vlan 1102" ); // Assign the IP address to the VLANs
    config.addScriptLine( "routing" );
    config.addScriptLine( "ip address 192.168.102.250 255.255.255.0" );
    config.addScriptLine( "exit" );

    config.addScriptLine( "interface vlan 1106" );
    config.addScriptLine( "routing" );
    config.addScriptLine( "ip address 192.168.6.11 255.255.255.0" );

    config.addScriptLine( "exit" );

    config.addScriptLine( "interface vlan 10" );
    config.addScriptLine( "routing" );
    config.addScriptLine( "ip address 172.16.10.1 255.255.255.0" );
    config.addScriptLine( "exit" );

    config.addScriptLine( "interface vlan 64" );
    config.addScriptLine( "routing" );
    config.addScriptLine( "ip address 172.16.64.1 255.255.255.0" );
    config.addScriptLine( "exit" );

    config.addScriptLine( "interface vlan 80" );
    config.addScriptLine( "routing" );
    config.addScriptLine( "ip address 172.16.80.1 255.255.255.0" );
    config.addScriptLine( "exit" );

    config.addScriptLine( "interface vlan 100" );
    config.addScriptLine( "routing" );
    config.addScriptLine( "ip address 172.16.100.1 255.255.255.0" );
    config.addScriptLine( "exit" );

    config.addScriptLine( "interface vlan 1199" );
    config.addScriptLine( "routing" );
    config.addScriptLine( "ip address 192.168.199.250 255.255.255.0" );
    config.addScriptLine( "exit" );

    config.addScriptLine( "ip route 0.0.0.0 0.0.0.0 192.168.6.1" ); //Set Default Route
};

Add-in as JSON file:

bind_ip_to_vlan_act_routing.json