FTP Connection Tracking in a Bridge
Hello,
I have a box running as a bridge and am trying to track the passive FTP sessions by marking them with iptables (CONNMARK option installed) and then trying to pick up the mark using tc filter fwmark. This is not working.
I have checked the marking of the packets and this is working fine because I can see the marks when I cat /proc/net/ip_conntrack.
Having setup my queues and using the following command:
tc filter add dev eth1 parent 1:2 protocol ip prio 1 handle 2 fw classid 1:2a
I do not get any traffic going in to this queue. I am running kernel 2.4.21.
My question is whether the packet that I have marked is actually every getting to the tc filter. As I am running a bridge, does the packet get marked in iptables PREROUTING, and then go straight to the FORWARD rule and then out.
What is the sequence in which iptables processes the packet and then the tc filter processes the packet.
Many thanks
Wayne
Quoted 6 lines · Wayne
Hello,
I have a box running as a bridge and am trying to track the passive FTP sessions by marking them with iptables (CONNMARK option installed) and then trying to pick up the mark using tc filter fwmark. This is not working.
Are you setting the mark (std fw mark) ? the connmark is not saved when leaving netfilter and reaching the QOS system.
See : http://home.regit.org/connmark.html for details
BR,
Signature · 2 lines
Eric Leblond <[email protected]> Regit.org
You must use fwmark setting and not connmark.
Mohan
-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of Wayne
Sent: Wednesday, August 20, 2003 2:18 PM
To: [email protected]
Subject: [LARTC] FTP Connection Tracking in a Bridge
Hello,
I have a box running as a bridge and am trying to track the passive FTP sessions by marking them with iptables (CONNMARK option installed) and then trying to pick up the mark using tc filter fwmark. This is not working. I have checked the marking of the packets and this is working fine because I can see the marks when I cat /proc/net/ip_conntrack.
Having setup my queues and using the following command:
tc filter add dev eth1 parent 1:2 protocol ip prio 1 handle 2 fw classid 1:2a
I do not get any traffic going in to this queue. I am running kernel 2.4.21. My question is whether the packet that I have marked is actually every getting to the tc filter. As I am running a bridge, does the packet get marked in iptables PREROUTING, and then go straight to the FORWARD rule and then out.
What is the sequence in which iptables processes the packet and then the tc filter processes the packet.
Many thanks
Wayne
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
I believe I am using fwmark as below. Any input would be appreciated:
Here is part of the setup:
iptables -A PREROUTING -t mangle -j CONNMARK --restore-mark iptables -A PREROUTING -t mangle -m mark ! --mark 0 -j ACCEPT iptables -A PREROUTING -m mark --mark 0 -p tcp --sport 21 -t mangle -j MARK --set-mark 14
iptables -A PREROUTING -m mark --mark 0 -p tcp --sport 80 -t mangle -j MARK --set-mark 2
iptables -A PREROUTING -m mark --mark 0 -p tcp --sport 3128 -t mangle -j MARK --set-mark 2
iptables -A PREROUTING -t mangle -j CONNMARK --save-mark
tc filter add dev eth1 parent 1:2 protocol ip prio 1 handle 2 fw classid 1:2a
Here is part of /proc/net/ip_conntrack showing the packet is getting marked:
tcp 6 431989 ESTABLISHED src.0.1.99 dst6.34.2.188 sport38
dport128 src6.34.2.188 dst.0.1.99 sport128 dport38 [ASSURED] use=1 mark=2
Here is part of the QOS class stats show no packets being picked up by the filter command:
class htb 1:2 parent 1:1001 leaf 2a: prio 0 quantum 1500 rate 22Kbit ceil 120Kbit burst 1627b/8 mpu 0b cburst 1752b/8 mpu 0b level 0
Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
lended: 0 borrowed: 0 giants: 0
tokens: 473600 ctokens: 93492
Thanks
Wayne
----- Original Message -----
From: "S Mohan" <[email protected]>
To: "Wayne" <[email protected]>; <[email protected]>
Sent: Wednesday, August 20, 2003 12:00 PM
Subject: RE: [LARTC] FTP Connection Tracking in a Bridge
Quoted 11 lines
You must use fwmark setting and not connmark.
Mohan
-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of Wayne
Sent: Wednesday, August 20, 2003 2:18 PM
To: [email protected]
Subject: [LARTC] FTP Connection Tracking in a Bridge
Quoted 3 lines
Hello,
I have a box running as a bridge and am trying to track the passive FTP sessions by marking them with iptables (CONNMARK option installed) and
then
Quoted 2 lines
trying to pick up the mark using tc filter fwmark. This is not working. I have checked the marking of the packets and this is working fine because
I
Quoted 5 lines
can see the marks when I cat
/proc/net/ip_conntrack.
Having setup my queues and using the following command:
tc filter add dev eth1 parent 1:2 protocol ip prio 1 handle 2 fw classid 1:2a
I do not get any traffic going in to this queue. I am running kernel
2.4.21.
Quoted 3 lines
My question is whether the packet that I have marked is actually every getting to the tc filter. As I am running a bridge, does the packet get marked in iptables PREROUTING, and then go straight to the FORWARD rule
and
Quoted 2 lines
then out.
What is the sequence in which iptables processes the packet and then the
tc
Quoted 5 lines
filter processes the packet.
Many thanks
Wayne
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Quoted 29 lines · Wayne
I believe I am using fwmark as below. Any input would be appreciated:
Here is part of the setup:
iptables -A PREROUTING -t mangle -j CONNMARK --restore-mark iptables -A PREROUTING -t mangle -m mark ! --mark 0 -j ACCEPT iptables -A PREROUTING -m mark --mark 0 -p tcp --sport 21 -t mangle -j MARK --set-mark 14
iptables -A PREROUTING -m mark --mark 0 -p tcp --sport 80 -t mangle -j MARK --set-mark 2
iptables -A PREROUTING -m mark --mark 0 -p tcp --sport 3128 -t mangle -j MARK --set-mark 2
iptables -A PREROUTING -t mangle -j CONNMARK --save-marktc filter add dev eth1 parent 1:2 protocol ip prio 1 handle 2 fw classid 1:2a
Here is part of
/proc/net/ip_conntrackshowing the packet is getting marked:tcp 6 431989 ESTABLISHED src.0.1.99 dst6.34.2.188 sport38
dport128 src6.34.2.188 dst.0.1.99 sport128 dport38 [ASSURED] use=1 mark=2Here is part of the QOS class stats show no packets being picked up by the filter command:
Quoted 7 lines
class htb 1:2 parent 1:1001 leaf 2a: prio 0 quantum 1500 rate 22Kbit ceil 120Kbit burst 1627b/8 mpu 0b cburst 1752b/8 mpu 0b level 0
Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
lended: 0 borrowed: 0 giants: 0
tokens: 473600 ctokens: 93492Thanks
Can you also post your filter rules ?
Stef
Signature · 8 lines
[email protected] "Using Linux as bandwidth manager" http://www.docum.org/ #lartc @ irc.oftc.net _______________________________________________ LARTC mailing list / [email protected] http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Quoted 22 lines · Wayne
Hello,
I have a box running as a bridge and am trying to track the passive FTP sessions by marking them with iptables (CONNMARK option installed) and then trying to pick up the mark using tc filter fwmark. This is not working.
I have checked the marking of the packets and this is working fine because I can see the marks when I cat
/proc/net/ip_conntrack.Having setup my queues and using the following command:
tc filter add dev eth1 parent 1:2 protocol ip prio 1 handle 2 fw classid 1:2a
I do not get any traffic going in to this queue. I am running kernel 2.4.21.
My question is whether the packet that I have marked is actually every getting to the tc filter. As I am running a bridge, does the packet get marked in iptables PREROUTING, and then go straight to the FORWARD rule and then out.
Quoted 4 lines
What is the sequence in which iptables processes the packet and then the tc filter processes the packet.
Many thanks
Just wondering, can you really use iptables on a bridge? I thought you have to use ebtables : http://www.docum.org/stef.coene/qos/faq/cache/41.html
Stef
Signature · 8 lines
[email protected] "Using Linux as bandwidth manager" http://www.docum.org/ #lartc @ irc.oftc.net _______________________________________________ LARTC mailing list / [email protected] http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Quoted 5 lines · Stef Coene
Quoted 1 line · Wayne
Hello,
Just wondering, can you really use iptables on a bridge? I thought you have to use ebtables : http://www.docum.org/stef.coene/qos/faq/cache/41.html
There's also a patch that brings a few change and enable filtering with iptables.
BR,
Signature · 2 lines
Eric Leblond <[email protected]> Regit.org
I have applied the patch to IPTABLES which allows me to use it on a bridge. The iptables rules are working as I am using it for other things as well. If you do not have the patch applied, you get an error message when trying to run IPTABLES.
The one filter rule I am using is as follows:
tc filter add dev eth1 parent 1:2 protocol ip prio 1 handle 2 fw classid 1:2a
I have the browsing match into the IPTABLES as it is a simpler one to check if it is working before I try the FTP connection tracking portion.
Thanks
Wayne
----- Original Message -----
From: "Stef Coene" <[email protected]>
To: "Wayne" <[email protected]>; <[email protected]>
Sent: Wednesday, August 20, 2003 2:26 PM
Subject: Re: [LARTC] FTP Connection Tracking in a Bridge
Quoted 5 lines · Wayne
Quoted 4 lines
Hello,
I have a box running as a bridge and am trying to track the passive FTP sessions by marking them with iptables (CONNMARK option installed) and
then
Quoted 3 lines
Quoted 3 lines
trying to pick up the mark using tc filter fwmark. This is not working.
I have checked the marking of the packets and this is working fine
because
Quoted 7 lines
Quoted 7 lines
I can see the marks when I cat
/proc/net/ip_conntrack.Having setup my queues and using the following command:
tc filter add dev eth1 parent 1:2 protocol ip prio 1 handle 2 fw classid 1:2a
Quoted 6 lines
Quoted 6 lines
I do not get any traffic going in to this queue. I am running kernel 2.4.21.
My question is whether the packet that I have marked is actually every getting to the tc filter. As I am running a bridge, does the packet get marked in iptables PREROUTING, and then go straight to the FORWARD rule
and
Quoted 3 lines
Quoted 3 lines
then out.
What is the sequence in which iptables processes the packet and then the
tc
Quoted 4 lines
Quoted 3 lines
filter processes the packet.
Many thanks
Just wondering, can you really use iptables on a bridge? I thought you
have
Quoted 12 lines
to use ebtables : http://www.docum.org/stef.coene/qos/faq/cache/41.html
Stef
Signature · 4 lines
[email protected] "Using Linux as bandwidth manager" http://www.docum.org/ #lartc @ irc.oftc.net
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Doh. So dumb of me. I have documented this but this skipped my attention. Thanks Staf. AFAIK, in a bridged mode, only the FORWARD table is processed. The packet does not traverse any other traditional netfilter table. This is the reason for the existence of ebtables. ebtables provides all these tables within its realm.
Mohan
-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of Stef Coene
Sent: Wednesday, August 20, 2003 5:57 PM
To: Wayne; [email protected]
Subject: Re: [LARTC] FTP Connection Tracking in a Bridge
Quoted 4 lines · Wayne
Hello,
I have a box running as a bridge and am trying to track the passive FTP sessions by marking them with iptables (CONNMARK option installed) and
then
Quoted 10 lines
trying to pick up the mark using tc filter fwmark. This is not working.
I have checked the marking of the packets and this is working fine because I can see the marks when I cat
/proc/net/ip_conntrack.Having setup my queues and using the following command:
tc filter add dev eth1 parent 1:2 protocol ip prio 1 handle 2 fw classid 1:2a
Quoted 6 lines
I do not get any traffic going in to this queue. I am running kernel 2.4.21.
My question is whether the packet that I have marked is actually every getting to the tc filter. As I am running a bridge, does the packet get marked in iptables PREROUTING, and then go straight to the FORWARD rule
and
Quoted 3 lines
then out.
What is the sequence in which iptables processes the packet and then the
tc
Quoted 3 lines
filter processes the packet.
Many thanks
Just wondering, can you really use iptables on a bridge? I thought you have to use ebtables : http://www.docum.org/stef.coene/qos/faq/cache/41.html
Stef
--
[email protected]
"Using Linux as bandwidth manager"
http://www.docum.org/
#lartc @ irc.oftc.net
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Quoted 5 lines · Wayne
I have applied the patch to IPTABLES which allows me to use it on a bridge. The iptables rules are working as I am using it for other things as well. If you do not have the patch applied, you get an error message when trying to run IPTABLES.
Quoted 7 lines
The one filter rule I am using is as follows:
tc filter add dev eth1 parent 1:2 protocol ip prio 1 handle 2 fw classid 1:2a
I have the browsing match into the IPTABLES as it is a simpler one to check if it is working before I try the FTP connection tracking portion.
You need more filter statements. You have parent 1:2 but how is traffic redirected to this class ???
Stef
Signature · 8 lines
[email protected] "Using Linux as bandwidth manager" http://www.docum.org/ #lartc @ irc.oftc.net _______________________________________________ LARTC mailing list / [email protected] http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Sorted. The problem was related to one of the filter statements. Interesting how we alwayts overlook the simple explanations as to why something does not work.
Thanks for all the help.
Wayne
----- Original Message -----
From: "Stef Coene" <[email protected]>
To: "Wayne" <[email protected]>; <[email protected]>
Sent: Wednesday, August 20, 2003 5:17 PM
Subject: Re: [LARTC] FTP Connection Tracking in a Bridge
Quoted 2 lines · Wayne
Quoted 1 line
I have applied the patch to IPTABLES which allows me to use it on a
bridge.
Quoted 1 line
Quoted 1 line
The iptables rules are working as I am using it for other things as
well.
Quoted 1 line
Quoted 1 line
If you do not have the patch applied, you get an error message when
trying
Quoted 8 lines
Quoted 8 lines
to run IPTABLES.
The one filter rule I am using is as follows:
tc filter add dev eth1 parent 1:2 protocol ip prio 1 handle 2 fw classid 1:2a
I have the browsing match into the IPTABLES as it is a simpler one to
check
Quoted 14 lines
Quoted 1 line
if it is working before I try the FTP connection tracking portion.
You need more filter statements. You have parent 1:2 but how is traffic redirected to this class ???
Stef
Signature · 4 lines
[email protected] "Using Linux as bandwidth manager" http://www.docum.org/ #lartc @ irc.oftc.net
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Quoted 5 lines · S Mohan
Doh. So dumb of me. I have documented this but this skipped my attention. Thanks Staf. AFAIK, in a bridged mode, only the FORWARD table is processed. The packet does not traverse any other traditional netfilter table. This is the reason for the existence of ebtables. ebtables provides all these tables within its realm.
Just for the record, as I'm the maintainer of ebtables and the bridge-nf code I can safely say that these statements above are not correct. ebtables is there to filter on non-IP stuff, more specifically the Ethernet header. In 2.6 or in a patched (with the bridge-nf patch) 2.4 kernel, the PREROUTING/FORWARD/POSTROUTING iptables chains see bridged traffic. This is therefore different than the behaviour with the old patch vs 2.2 for ipchains.
Anyone interested can go to ebtables.sourceforge.net, the working of iptables on a bridge is explained there in detail.
Please update your documentation.
cheers,
Bart
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/