Kemp Support, how can we help?

The latest application delivery knowledge and expertise at your fingertips.

How to block a specific IP address using WAF

A custom WAF rule can be crafted to block or blacklist a particular IP address. This is useful if there is a need to temporarily or permanently block an IP address.

Create a file in a text editor called block_ip_rule.conf (for example). Populate the file with the bold text below. The IP address, rule name, and rule ID provided are for example purposes only. These values can be changed to fit the end user needs.


# ---------------------------------------------------------------
# Blocks all access from IP
# ---------------------------------------------------------------

# The rule in this file will log all requests from the IP.


SecRule REMOTE_ADDR "@ipMatch" "id:'99999',phase:1,t:none,block,log,msg:'IP Block Rule'"



Custom generated rules should use the rule ID range of 1-99999. The use of numbers above 99999 will cause conflicts.

in the example above, "ipmatch" can also use a list with a combination of IPs and/or network.

For example:




Was this article helpful?
2 out of 2 found this helpful