# Problem logging after iptables drop all

**URL:** <https://forums.suse.com/t/problem-logging-after-iptables-drop-all/24566>\
**Category:** SLES Networking\
**Created:** [October 3, 2013, 9:58pm UTC](https://forums.suse.com/t/problem-logging-after-iptables-drop-all/24566 "2013-10-03T21:58:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcginlej](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@mcginlej](https://forums.suse.com/u/mcginlej)\
**Post date:** [October 3, 2013, 9:58pm UTC](https://forums.suse.com/t/problem-logging-after-iptables-drop-all/24566/1 "2013-10-03T21:58:44Z")

</div>

I’m looking for help logging dropped IPs (Non US). If I place the log request before the -P INPUT DROP all IPs get logged. I want to log dropped IPs other than US Amazon IPs. Can someone please advise.

-A INPUT -p tcp --dport 22 -j ACCEPT  
-A OUTPUT -p tcp --sport 22 -j ACCEPT  
-A INPUT -j LOG --log-level 4 --log-prefix 'InDrop ’  
-P INPUT DROP  
-A INPUT -s 192.168.0.0/24 -j ACCEPT  
-A INPUT -s 172.16.1.30/24 -j ACCEPT  
.  
. Accepting US IPs  
.  
-A INPUT -s 149.11.66.6/31 -j ACCEPT  
-A INPUT -s 72.44.32.0/19 -m limit --limit 5/m --limit-burst 7 -j LOG --log-prefix “Amazonaws IP Drop A:”  
-A INPUT -s 67.202.0.0/18 -m limit --limit 5/m --limit-burst 7 -j LOG --log-prefix “Amazonaws IP Drop A:”  
.  
. Logging Amazon Cloud  
.  
-A INPUT -s 54.233.0.0/18 -m limit --limit 5/m --limit-burst 7 -j LOG --log-prefix “Amazonaws IP Drop A:”  
-A INPUT -s 96.127.0.0/18 -m limit --limit 5/m --limit-burst 7 -j LOG --log-prefix “Amazonaws IP Drop A:”  
-A INPUT -s 72.44.32.0/19 -j DROP  
-A INPUT -s 67.202.0.0/18 -j DROP 😕  
.  
. Dropping Amazon Cloud  
.  
-A INPUT -s 174.129.0.0/16 -j DROP  
-A INPUT -s 204.236.192.0/18 -j DROP

Thanks,

Jamie

---

<div class="post-metadata">

**Author:** ![ab1](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@ab1](https://forums.suse.com/u/ab1)\
**Post date:** [October 3, 2013, 10:42pm UTC](https://forums.suse.com/t/problem-logging-after-iptables-drop-all/24566/2 "2013-10-03T22:42:07Z")

</div>

The location of the -P option shouldn’t matter much if I recall correctly,  
because it just declares what the default action is assuming no other rule  
matches. You should be able to verify this by comparing  
/usr/sbin/iptables-save or ‘/usr/sbin/iptables -nvL’ output between  
attempts to configure/setup your firewall settings by moving the iptables  
commands around.

Worst case you can add a -A INPUT -j DROP at the very end which  
effectively set the policy to drop for anything not already handled with  
another stopping target.

Good luck.
