301B practice question 29 of 30

What does the following iRule do? when CLIENT_ACCEPTED { if { [matchclass [IP::client_addr] equals WebClient1-Whitelist1] }{ #log local0. "Valid client IP: [IP::client_addr] - forwarding traffic" #Pool WebClient1 } else { log local0. "Invalid client IP: [IP::client_addr] - discarding" discard } }

Full set: 210 questions
Answer options
A: The iRule compares a client IP to a list. If the client IP is on the list, discard and log the discard.
B: The iRule compares a client IP to a list. If the client IP is NOT on the list, discard and log the discard. Correct answer
C: The iRule compares a client IP to a list. If the client IP is on the list, the client is sent to Pool WebClient1. Otherwise, discard and log the discard.
D: The iRule compares a client IP to a list. If the client IP is NOT on the list, the client is sent to Pool WebClient1. Otherwise, discard and log the discard.
Correct Answer:
B. The iRule compares a client IP to a list. If the client IP is NOT on the list, discard and log the discard.
Explanation

This iRule executes upon a new client connection (CLIENTACCEPTED). It checks if the client's source IP address ([IP::clientaddr]) is a member of the data group (class) named WebClient1-Whitelist1. The if condition is true if a match is found. However, the code block for a successful match is commented out, meaning no action is taken and the connection proceeds. The else block executes if the client IP is not found in the data group. In this case, it logs a message and then silently drops the connection using the discard command.

Why Incorrect

A. The iRule compares a client IP to a list. If the client IP is on the list, discard and log the discard: This reverses the logic; the discard action happens when the IP is not on the list.
C. The iRule compares a client IP to a list. If the client IP is on the list, the client is sent to Pool WebClient1...: The Pool command is commented out with a # and therefore does not execute.
D. The iRule compares a client IP to a list. If the client IP is NOT on the list, the client is sent to Pool WebClient1...: This reverses the logic and incorrectly assumes the commented-out Pool command is active.

References

F5, Inc. (2021). F5 iRules Wiki. DevCentral.

matchclass command page: "This command returns 1 if the item is found in the class, and 0 if it is not." (Note: class match is the modern equivalent).

discard command page: "Silently discards the connection. No RST or FIN is sent."

IP::clientaddr command page: "Returns the client-side IP address."

The logic is derived directly from the documented behavior of these commands and standard if/else conditional structure.

Scroll to Top