Forum Discussion

Vivek_K_215226's avatar
Vivek_K_215226
Icon for Nimbostratus rankNimbostratus
Jun 07, 2017

log the client ip if it matches a network in the data group

Hi There, I have data group class which contains both host's and network. I want to log the client ip only if it matches a network and not host.

 

Ex:

 

Client ip1: 10.75.18.21 Client ip2: 10.89.56.155

 

ACL file:

 

host 10.89.56.155 network 10.75.18.0/24

 

Here client ip1 is matching my subnet so log it. client ip2 is not matching so don't log it.

 

This is my current iRule. Any help on this is really appreciated. Thanks in advance.

 

when CLIENT_ACCEPTED { if { [ class match [IP::client_addr] equals clients_new ] } { pool new_clients_pool } else { reject } }

 

1 Reply

  • Hi,

    If I am understanding correctly, you can create 2 data groups 1 for host and 1 for network. Then use that iRule:

    when CLIENT_ACCEPTED {
    if { [ class match [IP::client_addr] equals clients_new_network ] } {
        pool new_clients_pool 
        log local0. "Client IP is [IP::client_addr]"
    }
    if { [ class match [IP::client_addr] equals clients_new_host ] } {
        pool new_clients_pool 
    }
    else {
        reject
    }
    }