Forum Discussion

waterfall_10467's avatar
waterfall_10467
Icon for Altostratus rankAltostratus
Jul 15, 2012

when_lb_failed

Hello,

 

 

If a client coming from 192.168.1.0 and 192.168.2.0 networks redirect to node1 else redirect to node2.However, when node1 is down ,move all active and new connections to node2 and again when node2 is down move all active and new connections to node1.

 

 

Please help me related to above scenario

 

 

thank you in advance,

 

 

Kind regard,

 

7 Replies

  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus
    Can

     

     

    Would a generic pool setting of Action on Service Down set to Reselect help here or do you specifically need to target only those hosts from 192.168.1.0 and 192.168.2.0?

     

     

    Hope this helps,

     

    N
  • Hi Nathan,

     

     

    Actually I need to indicate each remote network subnet and I need to load balance according to the networks. while clients are coming run two tcp port like 41000 and 56000 and these ports need to run on the same node.Therefore, I have configured the source adress affinity as match across services.and now as mentioned above how can I load balance via an irule. as you understand each node has both the 41000 and the 56000 ports.That's why there are two virtual server which have the same ip but just ports different like 41000 and 56000 so there are two pool and each pool member include 192.168.1.10:41000 and 192.168.1.11:41000 and other pool include 192.168.1.10:56000 and 192.168.1.11:56000

     

     

    if clients remote address match the 192.168.1.0 or 192.168.2.0 /24 network redirect to node1 else redirect to node2 but if node1 is down all active and new connections redirect to nod2 or if node2 is down all active and new connections redirect to node1

     

     

    I guess We need to use when client accepted and when lb failed parameters.

     

     

    Thank you in advance.
  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus
    Will this work for you then?

     

     

    Create a Data Group for 192.168.1.x and 192.168.2.x clients:

     

     

    class 192_group {

     

    {

     

    network 192.168.1.0/24

     

    network 192.168.2.0/24

     

    }

     

    }

     

     

    Create an iRule:

     

     

    when CLIENT_ACCEPTED {

     

     

    Check if Client Address is from the specific data group

     

    if { [class match [IP::remote_addr] equals $::192_group]} {

     

     

    node 192.168.1.10

     

    } else {

     

    node 192.168.1.11

     

    }

     

    }

     

     

    when LB_FAILED {

     

    pool test_pool

     

    LB::reselect

     

    log local0. "Selected server [LB::server] did not respond. Re-selecting node from test_pool"

     

    }

     

     

    Most of this taken from: https://devcentral.f5.com/wiki/iRules.node.ashx

     

     

    If you're on v9.x then use matchclass rather than class match command.

     

     

    Rgds

     

    N
  • what if virtual sever is listening on any port and pool member is also on any port. on pool, assign 2 health monitors which one checkes on port 41000 and the other one is on port 56000.

     

     

    for client 192.168.1.0/24 and 192.168.2.0/24, just check IP::client_addr and send to specific pool member if it is up.
  • Hi Nitass,

     

     

    let me be clear actually there are two virtual server which are listening different ports but their ip address same but their pools different because as you mentioned above each node is listening different ports and while a client is requesting to server which is running two different tcp ports and these ports need to be on the same server.therefore there are two different pool.

     

     

    regards,
  • i mean something like this. is it what you are asking?

    [root@ve10:Active] config  b virtual bar list
    virtual bar {
       snat automap
       pool foo
       destination 172.16.1.1:any
       ip protocol 6
       rules myrule
    }
    [root@ve10:Active] config  b pool foo list
    pool foo {
       monitor all tcp41000 and tcp56000
       members {
          192.168.1.10:any {}
          192.168.1.11:any {}
       }
    }
    [root@ve10:Active] config  b monitor tcp41000 list
    monitor tcp41000 {
       defaults from tcp
       dest *:41000
    }
    [root@ve10:Active] config  b monitor tcp56000 list
    monitor tcp56000 {
       defaults from tcp
       dest *:56000
    }
    [root@ve10:Active] config  b rule myrule list
    rule myrule {
       when CLIENT_ACCEPTED {
       if {[class match -- [IP::client_addr] equals network_class]} {
          if {[LB::status pool foo member 192.168.1.10 0] equals "up"} {
             pool foo member 192.168.1.10 0
          }
       }
    }
    }
    [root@ve10:Active] config  b class network_class list
    class network_class {
       {
          network 192.168.1.0/24
          network 192.168.2.0/24
       }
    }
    
  • Hello Nitass ,

     

     

    thank you for your reply. However the services ports are wanted to separate so we cannot set any port on the members.

     

     

    regards,