Forum Discussion

hung_105573's avatar
hung_105573
Icon for Nimbostratus rankNimbostratus
Jul 03, 2013

irule for base on source ip

hi all

 

i have a irule base on source ip address, that is server mail :

 

when CLIENT_ACCEPTED {

 

if { [IP::addr [IP::client_addr] equals 10.0.x.y] } {

 

snatpool NAT_MAILServer

 

}

 

else

 

{

 

snatpool Nat_Internet_live

 

}

 

}

 

 

snat pool :

 

 

ltm snatpool NAT_MAILServer {

 

members {

 

222.255.x.y ( this ip address is of line isp A)

 

183.91.x.y ( this ip address is of line isp B)

 

118.69.x.y ( this ip address is of line isp C)

 

}

 

}

 

ltm snatpool Nat_Internet_live {

 

members {

 

222.255.x.z

 

118.69.x.z

 

183.91.x.z

 

}

 

}

 

 

we want to modify this irule , so when the line ISP A goes die then can not SNAT 222.255.x.y , line ISP B die then can not SNAT 183.91.x.y,...

 

 

pls help me

 

many thanks

 

3 Replies

  • Hi Hung, You can add nodes to the F5 with the ping monitor. For example each ISP has customer edge router/device that maybe pingable by your F5. You would add the customer edge router as a node and put a ICMP ping as the default monitor for the node. Then you modify the irule to check for the UP/DOWN Status of the node

    For Example

    when CLIENT_ACCEPTED {
     if {[IP::addr [IP::client_addr] eq 10.0.x.y]}{
           if { [LB::status node IP_ADDRESS_OF_ISP-A_node ] eq "up" } { 
               snatpool NAT_MAILServer member 255.255.x.y
           } elseif { [LB::status node IP_ADDRESS_OF_ISP-B_node ] eq "up" } {
               snatpool NAT_MAILServer member 183.91.x.y 
           } elseif { [LB::status node IP_ADDRESS_OF_ISP-C_node ] eq "up" } {
               snatpool NAT_MAILServer member 118.69.x.y
           }
     else
        if { [LB::status node [LB::status node IP_ADDRESS_OF_ISP-A_node ] eq "up" } { 
               snatpool NAT_MAILServer member 255.255.x.z
           } elseif { [LB::status node IP_ADDRESS_OF_ISP-B_node ] eq "up" } {
               snatpool NAT_MAILServer member 183.91.x.z
           } elseif { [LB::status node IP_ADDRESS_OF_ISP-C_node ] eq "up" } {
               snatpool NAT_MAILServer member 118.69.x.z
           }
     } }
    

    I hope this helps

    -=Bhattman=-

  • Nice reply also in addition to this I will say one thing I am sure currently you don't have a correct monitor on your gateway pool which has the IP address of all the Three ISP routers. So when any of the link is down it still sends the traffic to that SNAT as for the F5 device the status is unknown. I would like to request Bhattman if you can explain how a monitor can be made that can access a google or any website at certain interval both "http & https" to declare that the internet is live through that link.

     

    Regards,

     

  • Nice reply also in addition to this I will say one thing I am sure currently you don't have a correct monitor on your gateway pool which has the IP address of all the Three ISP routers. So when any of the link is down it still sends the traffic to that SNAT as for the F5 device the status is unknown. I would like to request Bhattman if you can explain how a monitor can be made that can access a google or any website at certain interval both "http & https" to declare that the internet is live through that link.

     

    Regards,