Skip to contentSkip to conversation

Connection Protocol in the state?

DISCUSSION Christoph Paasch 2 participants 4 messages Oct 1, 2008 – Oct 5, 2008 netfilter

lore
Share & tools
lore
#0 lore raw

Hello,

I would like to know, that if I have a filter like the one shown below (allowing outgoing connections of every protocol-type), does netfilter stores in the state of the established outgoing connection also the protocol which established the connection? (TCP, UDP, ....) Or does it opens the connection for any protocol?

iptables -A FORWARD -i eth0 --ctstate NEW, RELATED, ESTABLISHED -j ACCEPT

Thanks in advance

Signature · 4 lines
Christoph Paasch

www.rollerbulls.be
--
#1 lore raw
Quoted 8 lines · Christoph Paasch

I would like to know, that if I have a filter like the one shown below (allowing outgoing connections of every protocol-type), does netfilter stores in the state of the established outgoing connection also the protocol which established the connection? (TCP, UDP, ....) Or does it opens the connection for any protocol?

iptables -A FORWARD -i eth0 --ctstate NEW, RELATED, ESTABLISHED -j ACCEPT

Read the really-really-really-nice manpage (which has gotten so much care from me). I mean, hey, it's directly below --ctstate! :-)

[!] --ctproto l4proto
Layer-4 protocol to match (by number or name)

#2 lore raw

Hello,

Quoted 6 lines

Read the really-really-really-nice manpage (which has gotten so much care from me). I mean, hey, it's directly below --ctstate! :-)

[!] --ctproto l4proto
Layer-4 protocol to match (by number or name)

Hmm... so, you mean that the established connection doesn't makes the difference between the different protocols, as long as those aren't specified with "--ctproto".

So, if I got an established TCP-connection, I can do run any other protocol (UDP, ... and in particular shim6 ;-) in any direction. And also on any port number?

Sorry, but I think, that it's not clear, what is stored in the state, of a connection, if the iptables rule doesn't specifies the protocol, portnumber,
...

Thanks for answering, and have a nice day...

Christoph Paasch

#3 lore raw
Quoted 6 lines · Christoph Paasch

Hello,

Quoted 4 lines

Read the really-really-really-nice manpage (which has gotten so much care from me). I mean, hey, it's directly below --ctstate! :-)

Quoted 6 lines
Quoted 2 lines

[!] --ctproto l4proto
Layer-4 protocol to match (by number or name)

Hmm... so, you mean that the established connection doesn't makes the difference between the different protocols, as long as those aren't specified with "--ctproto".

Correct, -m conntrack is naturally protocol-independent. You can use either -p tcp or --ctproto tcp to check for protocol-specific parts. Note that -p and --ctproto have different meaning, but I have yet to see a connection tracker that puts, say, non-tcp packets into a tcp connection.

Quoted 3 lines

So, if I got an established TCP-connection, I can do run any other protocol (UDP, ... and in particular shim6 ;-) in any direction. And also on any port number?

You will never see the SHIM layer if you are doing filtering at layer-3 (which is what ip6tables does).

Quoted 2 lines

Sorry, but I think, that it's not clear, what is stored in the state, of a connection, if the iptables rule doesn't specifies the protocol, portnumber,

connection = (srcip, dstip, l4stuff)
l4stuff#tcp= (srcport, dstport)