Skip to contentSkip to conversation

ICMP and state/conntrack

DISCUSSION [email protected] 4 participants 5 messages Feb 28, 2003

lore
Share & tools
lore
#0 lore raw

Hello

I'm wondering if state doesn't apply to ICMP packets.

iptables -A FORWARD -p icmp -m state -d 1.2.3.4 --state NEW -j ACCEPT iptables -A FORWARD -m state --state NEW,INVALID -j REJECT

if I ping 1.2.3.4 the echo-reply is blocked from 1.2.3.4. Is this normal, I thought that the echo-reply should be marked RELATED and therefore not blocked?

====
Tomas Edwardsson
HP Technical Support \ HP Certified System Administrator
Red Hat Technical Support \ Red Hat Certified Engineer. Opin Kerfi

#1 lore raw
Quoted 1 line · Le ven 28/02/2003 à 11:37, [email protected] a écrit :

I'm wondering if state doesn't apply to ICMP packets.

It applies.

Quoted 5 lines

iptables -A FORWARD -p icmp -m state -d 1.2.3.4 --state NEW -j ACCEPT iptables -A FORWARD -m state --state NEW,INVALID -j REJECT
if I ping 1.2.3.4 the echo-reply is blocked from 1.2.3.4. Is this normal, I thought that the echo-reply should be marked RELATED and therefore not blocked?

Nope.
In fact, you can separate ICMP messages in two categories :

. ICMP errors
. standelone ICMP

ICMP errors are related to an existing IP flow. As such, conntrack engine flags them as RELATED.

Standelone ICMP (ping, netmask, timestamp and info, cf. ip_conntrack_proto_icmp.c) are not related to IP flow, and are flagged using NEW/ESTABLISHED states.
If you ping someone, echo-request is NEW, echo-reply is ESTABLISHED.

Signature · 4 lines
Cédric Blancher  <[email protected]>
IT systems and networks security expert  - Cartel Sécurité
Phone : +33 (0)1 44 06 97 87 - Fax: +33 (0)1 44 06 97 99
PGP KeyID:157E98EE  FingerPrint:FA62226DA9E72FA8AECAA240008B480E157E98EE
#2 lore raw

Great and thanks for your swift replies.

The problem was actually a routing problem.

- Tomas

Quoted 33 lines · Cedric Blancher
Quoted 1 line · Le ven 28/02/2003 à 11:37, [email protected] a écrit :

I'm wondering if state doesn't apply to ICMP packets.

It applies.

Quoted 5 lines

iptables -A FORWARD -p icmp -m state -d 1.2.3.4 --state NEW -j ACCEPT iptables -A FORWARD -m state --state NEW,INVALID -j REJECT
if I ping 1.2.3.4 the echo-reply is blocked from 1.2.3.4. Is this normal, I thought that the echo-reply should be marked RELATED and therefore not blocked?

Nope.
In fact, you can separate ICMP messages in two categories :

. ICMP errors
. standelone ICMP

ICMP errors are related to an existing IP flow. As such, conntrack engine flags them as RELATED.

Standelone ICMP (ping, netmask, timestamp and info, cf. ip_conntrack_proto_icmp.c) are not related to IP flow, and are flagged using NEW/ESTABLISHED states.
If you ping someone, echo-request is NEW, echo-reply is ESTABLISHED.

Signature · 4 lines
Cédric Blancher  <[email protected]>
IT systems and networks security expert  - Cartel Sécurité
Phone : +33 (0)1 44 06 97 87 - Fax: +33 (0)1 44 06 97 99
PGP KeyID:157E98EE  FingerPrint:FA62226DA9E72FA8AECAA240008B480E157E98EE
#3 lore raw
In reply to [email protected]

Hellow :)

Quoted 1 line

iptables -A FORWARD -m state --state NEW,INVALID -j REJECT

You must be especify the protocol on this rule:

iptables -A FORWARD -p icmp -m state --state NEW,INVALID -j REJECT

You has that to understand tables with independent rules

Brazil rules : carnaval 2003 :)

Signature · 4 lines
surf3r  -o)
        /\\
       _\_V
--   --------
Quoted 20 lines · On Fri, 2003-02-28 at 07:37, [email protected] wrote:

Hello

I'm wondering if state doesn't apply to ICMP packets.

iptables -A FORWARD -p icmp -m state -d 1.2.3.4 --state NEW -j ACCEPT iptables -A FORWARD -m state --state NEW,INVALID -j REJECT

if I ping 1.2.3.4 the echo-reply is blocked from 1.2.3.4. Is this normal, I thought that the echo-reply should be marked RELATED and therefore not blocked?

====
Tomas Edwardsson
HP Technical Support \ HP Certified System Administrator
Red Hat Technical Support \ Red Hat Certified Engineer. Opin Kerfi

#4 lore raw
In reply to [email protected]
Quoted 8 lines · On Fri, 28 Feb 2003 [email protected] wrote:

I'm wondering if state doesn't apply to ICMP packets.

iptables -A FORWARD -p icmp -m state -d 1.2.3.4 --state NEW -j ACCEPT iptables -A FORWARD -m state --state NEW,INVALID -j REJECT

if I ping 1.2.3.4 the echo-reply is blocked from 1.2.3.4. Is this normal, I thought that the echo-reply should be marked RELATED and therefore not blocked?

ICMP echo-reply is not an ICMP error message, it is not RELATED to another connection. You can match is as ESTABLISHED.

Regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics

          H-1525 Budapest 114, POB. 49, Hungary