Allied Telesis Routers and Switches manual Create the Scripts

Page 9

Create the Scripts

This section describes the scripts that the trigger facility runs when the master or slave load balancer changes. Create the same scripts on both load balancer 1 and load balancer 2.

Create the scripts in a text editor on your PC. You can then open the router’s editor by using the command edit master.scp (or edit slave.scp) and copy and paste the text of the script into the editor. Use Ctrl+K+X to save the script and exit.

Alternatively, you can copy your PC-created script to a TFTP server and use the router’s load command to download the files from the server.

!Script for when a load balancer becomes the master: master.scp

#Add the load balancer virtual interface (vlan2-1) to the firewall policy

#as a public interface.

#

add firewall policy=lb int=vlan2-1 type=public

#Add an allow rule for web traffic access. Note that this rule does not map

#to a private address, as expected on a NAT firewall. It just opens the port.

#The load balancer handles security and NAT redirection to the server.

#

add firewall policy=lb rule=1 int=vlan2-1 action=allow protocol=tcp port=80

#Set the VRRP priority level to a value higher than the slave's priority.

set vrrp=2 priority=200

!Script for when a load balancer becomes the slave: slave.scp

#Remove the load balancer virtual interface (vlan2-1).

#

delete firewall policy=lb int=vlan2-1

#Remove the associated access rule.

delete firewall policy=lb rule=1

#Set the VRRP priority level to a value lower than the master's priority.

set vrrp=2 priority=100

Configure Load Balancer Redundancy on Allied Telesis Routers and Switches

9

Image 9
Contents Examples IntroductionWhich products and software version does it apply to? What information will you find in this document?Example of Basic Redundancy Configure Load BalancerDisable the GUI and the Http server on port Configure the firewallConfigure load balancing Configure VrrpSave the configuration Configure triggersSet system name=LB-2 Either Create the Scripts Script for when a load balancer becomes the slave slave.scpExtension Controlling Server Selection Configure Load Balancing Extra CommandsModify the Scripts Configure the Triggers Extra CommandsMaster.scp Slave.scpCreate New Scripts Script for when the preferred server goes down sftp1down.scpCommands Load Balancer Configuration SummaryCommands Load Balancer File slave.scp File master.scpFile sftp1down.scp File sftp1up.scp