Forum Discussion

ITHelpdesk_3215's avatar
ITHelpdesk_3215
Icon for Nimbostratus rankNimbostratus
May 23, 2017

Redirect Specific source network to specific pool member

Is there a way to direct specific source networks to a specific pool member and still have LB for every other source? In essence bypass the LB for a specific source network to one member.

 

1 Reply

  • AndOs's avatar
    AndOs
    Icon for Cirrostratus rankCirrostratus

    Yes.

    You could use something simple like this

     when RULE_INIT {
         set static::bypass_LB_net "10.20.118.0/24"
         set static::bypass_LB_member "10.210.34.100"
     }
    
     when CLIENT_ACCEPTED {
    
         set currentpool [LB::server pool]
    
        if { [IP::addr [IP::client_addr] equals $static::bypass_LB_net] } { 
            pool $currentpool member $static::bypass_LB_member
        }
     }
    

    or if you want to be more dynamic, use a datagroup where you define which network you want to send to which pool member.

     ltm data-group internal bypass_LB_DG {
         partition test
         records {
             10.10.20.0/24 {
                 data 10.110.30.43
             }
             10.20.118.0/24 {
                 data 10.210.34.100
             }
         }
         type ip
     }
    
     ltm rule bypass_LB_irule {
     when CLIENT_ACCEPTED {
    
        set currentpool [LB::server pool]
    
        set poolmember [class match -value [IP::client_addr] equals bypass_LB_DG]
    
        if { $poolmember ne "" } {
                 some errorhandling is always good to have :)
            if { [catch {
    
                    pool $currentpool member $poolmember
    
                } poolselectstatus] != 0} {
                        log local0. "Error selecting member $poolmember $poolselectstatus"
                    }   
        }
     }
     }
    

    These are a bit untested but hopefully you can get something out of them 🙂

    /Andreas