Skip to contentSkip to conversation

New chain

DISCUSSION Mattia Martinello 2 participants 3 messages Jan 11, 2003 – Jan 12, 2003

lore
Share & tools
lore
#0 lore raw

Hi

I wish to create and use a new chain which logs all DROP packets, but after DROP rules i must write ACCEPT rules too. All DROP packets (not ALLOWED ones) have to be logged.
I wish to open the comunications between 192.168.1.0/24 and 192.168.1.254.
All packets between 192.168.1.0/24 and 192.168.1.254 haven't to be logged.

I tried to do this:

iptables -N LOG_DROP
iptables -A LOG_DROP -j LOG --log-tcp-options --log-ip-options --log-prefix '[IPTABLES DROP] : ' iptables -A LOG_DROP -j DROP

iptables -A INPUT -j LOG_DROP
iptables -A OUTPUT -j LOG_DROP
iptables -A FORWARD -j LOG_DROP

iptables -A LOG_DROP -s 192.168.1.0/24 -d 192.168.1.254/255.255.255.255 -j ACCEPT iptables -A LOG_DROP -s 192.168.1.254/255.255.255.255 -d 192.168.1.0/24 -j ACCEPT

But it doesn't work.
Could you tell me how I can solve this problem, please?

Thank you very much
Bye
Mattia

#1 lore raw

El Sáb 11 Ene 2003 23:58, Mattia Martinello escribió:

If I am not wrong, chains are read sequentially. If you say first:

Quoted 1 line

iptables -A LOG_DROP -j DROP

and then you add "new" rules to your firewall script:

Quoted 4 lines

iptables -A LOG_DROP -s 192.168.1.0/24 -d 192.168.1.254/255.255.255.255 -j ACCEPT
iptables -A LOG_DROP -s 192.168.1.254/255.255.255.255 -d 192.168.1.0/24 -j ACCEPT

it wont work, because everything before the DROP rule will NOT be parsed. I'm my particular case, I should "insert" those rules you want to be accepted before de DROP one. That's why I set my LOG and DROP rules in the last lines of the script.

Please, correct me if I am in mistake, and sorry my bad english.

Regards.

-Miguel Angel Baeyens

KeyID: 0x6FB7A511 en rediris.es

#2 lore raw

MAB ha scritto:

Quoted 2 lines

Please, correct me if I am in mistake, and sorry my bad english.

You aren't in mistake! Thank you very much for this advise... Now I remember this "little" thing... :-)
Thanks a lot!

Bye
Mattia