1Allows you to dynamically create a list of IP addresses and then match against 2that list in a few different ways. 3.PP 4For example, you can create a "badguy" list out of people attempting to connect 5to port 139 on your firewall and then DROP all future packets from them without 6considering them. 7.PP 8\fB\-\-set\fP, \fB\-\-rcheck\fP, \fB\-\-update\fP and \fB\-\-remove\fP are 9mutually exclusive. 10.TP 11\fB\-\-name\fP \fIname\fP 12Specify the list to use for the commands. If no name is given then 13\fBDEFAULT\fP will be used. 14.TP 15[\fB!\fP] \fB\-\-set\fP 16This will add the source address of the packet to the list. If the source 17address is already in the list, this will update the existing entry. This will 18always return success (or failure if \fB!\fP is passed in). 19.TP 20\fB\-\-rsource\fP 21Match/save the source address of each packet in the recent list table. This 22is the default. 23.TP 24\fB\-\-rdest\fP 25Match/save the destination address of each packet in the recent list table. 26.TP 27[\fB!\fP] \fB\-\-rcheck\fP 28Check if the source address of the packet is currently in the list. 29.TP 30[\fB!\fP] \fB\-\-update\fP 31Like \fB\-\-rcheck\fP, except it will update the "last seen" timestamp if it 32matches. 33.TP 34[\fB!\fP] \fB\-\-remove\fP 35Check if the source address of the packet is currently in the list and if so 36that address will be removed from the list and the rule will return true. If 37the address is not found, false is returned. 38.TP 39\fB\-\-seconds\fP \fIseconds\fP 40This option must be used in conjunction with one of \fB\-\-rcheck\fP or 41\fB\-\-update\fP. When used, this will narrow the match to only happen when the 42address is in the list and was seen within the last given number of seconds. 43.TP 44\fB\-\-hitcount\fP \fIhits\fP 45This option must be used in conjunction with one of \fB\-\-rcheck\fP or 46\fB\-\-update\fP. When used, this will narrow the match to only happen when the 47address is in the list and packets had been received greater than or equal to 48the given value. This option may be used along with \fB\-\-seconds\fP to create 49an even narrower match requiring a certain number of hits within a specific 50time frame. The maximum value for the hitcount parameter is given by the 51"ip_pkt_list_tot" parameter of the xt_recent kernel module. Exceeding this 52value on the command line will cause the rule to be rejected. 53.TP 54\fB\-\-rttl\fP 55This option may only be used in conjunction with one of \fB\-\-rcheck\fP or 56\fB\-\-update\fP. When used, this will narrow the match to only happen when the 57address is in the list and the TTL of the current packet matches that of the 58packet which hit the \fB\-\-set\fP rule. This may be useful if you have problems 59with people faking their source address in order to DoS you via this module by 60disallowing others access to your site by sending bogus packets to you. 61.PP 62Examples: 63.IP 64iptables \-A FORWARD \-m recent \-\-name badguy \-\-rcheck \-\-seconds 60 \-j DROP 65.IP 66iptables \-A FORWARD \-p tcp \-i eth0 \-\-dport 139 \-m recent \-\-name badguy \-\-set \-j DROP 67.PP 68Steve's ipt_recent website (http://snowman.net/projects/ipt_recent/) also has 69some examples of usage. 70.PP 71\fB/proc/net/xt_recent/*\fP are the current lists of addresses and information 72about each entry of each list. 73.PP 74Each file in \fB/proc/net/xt_recent/\fP can be read from to see the current 75list or written two using the following commands to modify the list: 76.TP 77\fBecho +\fP\fIaddr\fP\fB >/proc/net/xt_recent/DEFAULT\fP 78to add \fIaddr\fP to the DEFAULT list 79.TP 80\fBecho \-\fP\fIaddr\fP\fB >/proc/net/xt_recent/DEFAULT\fP 81to remove \fIaddr\fP from the DEFAULT list 82.TP 83\fBecho / >/proc/net/xt_recent/DEFAULT\fP 84to flush the DEFAULT list (remove all entries). 85.PP 86The module itself accepts parameters, defaults shown: 87.TP 88\fBip_list_tot\fP=\fI100\fP 89Number of addresses remembered per table. 90.TP 91\fBip_pkt_list_tot\fP=\fI20\fP 92Number of packets per address remembered. 93.TP 94\fBip_list_hash_size\fP=\fI0\fP 95Hash table size. 0 means to calculate it based on ip_list_tot, default: 512. 96.TP 97\fBip_list_perms\fP=\fI0644\fP 98Permissions for /proc/net/xt_recent/* files. 99.TP 100\fBip_list_uid\fP=\fI0\fP 101Numerical UID for ownership of /proc/net/xt_recent/* files. 102.TP 103\fBip_list_gid\fP=\fI0\fP 104Numerical GID for ownership of /proc/net/xt_recent/* files. 105