Forum Discussion

xiaolche's avatar
xiaolche
Icon for Nimbostratus rankNimbostratus
Feb 15, 2023

Collect UDP packet client IP with irule on LTM

Could anyone tell me how to collect client IP address with irule and save client ip to log ?

We have VIP which is for DNS and NTP service,  protocol profile is UDP  ( without Datagram LB enable) . i use below irule  in a  DNS VIP ( there is huge dns request to the vip ) , it worked for a few packets , then VIP stopped to response the dns request.   where is wrong on the irule ?  thanks for help in advance

when CLIENT_ACCEPTED {
log -noname local0. "[virtual name] client [IP::client_addr]:[UDP::client_port] test-snat [IP::local_addr]:[UDP::local_port] server [IP::server_addr]:[UDP::server_port]"
}

 

 

 

3 Replies

  • xiaolche Do you see any logs showing errors for that iRule after it was applied? Typically if something is wrong with the iRule you will see a log generated on your F5 to show what is causing the issue. If this is a virtual that is used a significant amount you could be logging too often which might cause your logs to exponentially increase in size but not just disable the one virtual server I don't believe. The syntax of that logging message seems to be correct but that is a significant amount of information that is being logged rather than just the client IP.

  • As per the doc here the command [IP::server_addr] is not available in the CLIENT_ACCEPTED event. I wonder how the iRule can succeed in some cases. As Paulius suggested you should see error messages if the iRule does contain errors. Can you check this? 

    • xiaolche's avatar
      xiaolche
      Icon for Nimbostratus rankNimbostratus

      Thank you both.   I tried SERVER_CONNECTED first , then changed to CLIENT_ACCEPTED . So the log i saw maybe from server_connected. I will test again during maitenance window.

      -xiaolin