Description:
The script configures everything that is necessary to configure an IKE load balancer for a the head office (including DMZ network, VRRP & route).
List of used variables:
Add-in code:
exports.main = function (config, context) {
if (context.network.isCentralGateway) {
var networkList = config.getTableByOid("1.2.7.30");
var rowDmz = networkList.createNewRow();
rowDmz.setByOid("1", "DMZ");
rowDmz.setByOid("2", context.vars.DMZ_IP);
rowDmz.setByOid("3", "255.255.255.0");
rowDmz.setByOid("4", "1");
rowDmz.setByOid("5", "256");
rowDmz.setByOid("6", "0");
rowDmz.setByOid("7", "2");
rowDmz.setByOid("8", "0");
rowDmz.setByOid("9", "demilitarized zone");
networkList.addOrMerge(rowDmz);
var routingTable = config.getTableByOid("1.2.8.2");
var routeToGw = routingTable.createNewRow();
routeToGw.setByOid("1", "255.255.255.255");
routeToGw.setByOid("2", "0.0.0.0");
routeToGw.setByOid("8", "0");
routeToGw.setByOid("6", "0");
routeToGw.setByOid("3", context.vars.DMZ_GW);
routeToGw.setByOid("4", "0");
routeToGw.setByOid("5", "0");
routeToGw.setByOid("7", "");
routingTable.addOrMerge(routeToGw);
config.setScalarByOid("1.2.102.12", "DMZ");
config.setScalarByOid("1.2.8.21.1", "1");
config.setScalarByOid("1.2.8.21.3", "30");
var vrrpList = config.getTableByOid("1.2.8.21.2");
var vrrpRow = vrrpList.createNewRow();
vrrpRow.setByOid("1", context.vars.VRID);
vrrpRow.setByOid("2", context.vars.VRRP_IP);
vrrpRow.setByOid("3", context.vars.VRRP_PRIO);
vrrpList.addOrMerge(vrrpRow);
config.setScalarByOid("1.2.19.50.1", "1");
var lbInstances = config.getTableByOid("1.2.19.50.2");
var lbInstance = lbInstances.createNewRow();
lbInstance.setByOid("1", context.vars.VRID);
lbInstance.setByOid("2", context.vars.DMZ_IP);
lbInstance.setByOid("4", "DEFAULT");
lbInstances.addOrMerge(lbInstance);
var messageProfiles = config.getTableByOid("1.2.19.50.3");
var profile = messageProfiles.createNewRow();
profile.setByOid("1", "DEFAULT");
profile.setByOid("2", "DMZ");
profile.setByOid("3", "239.255.22.11");
profile.setByOid("4", "1987");
profile.setByOid("5", "2000");
profile.setByOid("6", "3000");
profile.setByOid("7", "5");
profile.setByOid("8", "15");
profile.setByOid("9", context.vars.LOAD_PASSWORD);
profile.setByOid("10", "3");
profile.setByOid("11", "1");
messageProfiles.addOrMerge(profile);
}
};
|
---|
Add-in as JSON file:
ike_load_balancer.json