# Configure a redirector host to distribute incoming Web requests 
# addressed to port 80 on 10.1.1.1 equally (Round Robin )
# to  port  80 on  2 Web server hosts ( 192.168.10.1 , 192.168.10.2 ). 
# The networking model for this example is NAT with each of the real
# servers being masqueraded by the LVS.
# see also ipvsadm(8).
#-A -t 10.1.1.1:80 -s rr
#-a -t 10.1.1.1:80 -r 192.168.10.2:80 -m -w 1

{
	if ($InternetAccessType =~ /lan/i ) {
	   for ($i=0; $i<5; $i++) {
		my $interface = "Eth".$i;
		my $EthKnown = eval ('$'.$interface."Known") ;
		my $EthIP = eval ('$'.$interface."IP");

		next if ( !($EthIP) ) ;
		if (($EthKnown !~ /^\s*$/) && ($EthKnown eq "true") && ($interface =~ /$InternetInterface/i)) {
			my $VS;
			if ( $FirewallMasquerade =~ /on/i ) { $VS="m"; } else { $VS="g"; }
			if (defined $TCP_PUBLIC_SERVICES) {
				foreach (split (/,/ , $TCP_PUBLIC_SERVICES)) {
					my ($item, $attr_list) = /(\S+)\s*\((.*)\)/;
					if ($attr_list) {
						my @vals = split (' ', $attr_list);
						foreach $val (@vals) {
							my ($attr, $value) = split ('\s*=\s*',  $val);
							if  (($attr =~ /forward/ ) && ( $value !~ /---/ )) {

								if ($item =~ /^\s*all\s*$/) {
									$OUT .= "-A -t $EthIP:0 -s rr -p\n";
									$OUT .= "-a -t $EthIP:0 -r $value:0 -$VS \n"; last; }
								else {
									$OUT .= "-A -t $EthIP:$item -s rr\n";
									$OUT .= "-a -t $EthIP:$item -r $value:$item -$VS \n"; }

							} # if
						} # foreach
					} #if
				} # foreach
			} #if TCP
		} # if
	   } # for
	} # if
}
