Supported file formats: p2p, dat, csv and ipl. Use "-" to read from stdin. Files can optionally be compressed with gzip.
The idea is to send packets that are not marked with a policy-mark to iplist. If a packet doesn't match any IP-addresses, iplist marks and repeats it to the source chain.
This rule would send every packet which isn't marked with a policy-mark to iplist
#> iptables -I INPUT -m mark ! --mark 1 -j NFQUEUE
iplist would then be started like this
#> iplist --policy repeat --policy-mark 1 --target drop file.p2p
The result of this setup is that any incoming packets that match IP-addresses in file.p2p are dropped, everything else is handled by the rest of the iptables configuration.
#> iptables -I INPUT -p tcp -m state --state NEW --dport 6991:6999 -j NFQUEUE
#> iptables -I OUTPUT -p tcp -m state --state NEW --sport 6991:6999 -j NFQUEUE
Then iplist can be started like this
#> iplist -p accept -t drop --stdout -l match bad.p2p
All packets that are dropped are logged and printed to the terminal.
#> iptables -I INPUT 1 -m mark --mark 2 -j REJECT
#> iptables -I INPUT 2 -m mark ! --mark 1 -j NFQUEUE
#> iplist -p repeat -P 1 -t repeat --target-mark 2 bad.p2p
The order of the iptables rules is important. The reject rule must be first.