Skip to contentSkip to conversation

IMQ and fwmark

LARTC Daniel Brahneborg 2 participants 2 messages Jul 29, 2003

lore
Share & tools
lore
#0 lore raw

Hi all,

I want to divide the incoming traffic between what should go to the firewall and what should be forwarded to the local network behind it. I started with the IMQ example config, but added an extra htb class right below "10:1" to get the two sfq's to borrow each other's bandwidth.

However, I can't figure out how to set the two marks. According to this picture, taken from http://lartc.org/lartc.html, I thought I could set the marks in FORWARD and INPUT, but that didn't work at all. The traffic ends up in imq0 as it should, but only goes to the default class. Moving the '-j IMQ' to the INPUT and FORWARD tables didn't work either. What have I done wrong?

        +------------+                +---------+               +-------------+
Packet -| PREROUTING |--- routing-----| FORWARD |-------+-------| POSTROUTING |- Packets
input   +------------+    decision    +---------+       |       +-------------+    out
                             |                          |
                       +-------+                    +--------+   
                       | INPUT |---- Local process -| OUTPUT |
                       +-------+                    +--------+

iptables -t mangle -A INPUT -i $EXTERNAL_INTERFACE -p tcp -j MARK --set-mark 0x1
iptables -t mangle -A FORWARD -i $EXTERNAL_INTERFACE -p tcp -j MARK --set-mark 0x2 iptables -t mangle -A PREROUTING -i $EXTERNAL_INTERFACE -j IMQ

/Basic

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#1 lore raw

Access to the IMQ interface sits between the mangle and DNAT tables in the PREROUTING chain and after the connection tracking table in the POSTROUTING chain. There isn't much point in setting marks for the IMQ from the INPUT and FORWARD chains as these are traversed AFTER the IMQ interface (PREROUTE). To correctly set the marks then you would need to set them in the mangle table of the PREROUTE chain and do it based on address. Hope this helps.

Andrew.
----- Original Message -----
From: "Daniel Brahneborg" <[email protected]>
To: "Linux Advanced Router & Traffic Control" <[email protected]>
Sent: Tuesday, July 29, 2003 6:55 PM
Subject: [LARTC] IMQ and fwmark

Quoted 8 lines

Hi all,

I want to divide the incoming traffic between what should go to the firewall and what should be forwarded to the local network behind it. I started with the IMQ example config, but added an extra htb class right below "10:1" to get the two sfq's to borrow each other's bandwidth.

Quoted 8 lines

However, I can't figure out how to set the two marks. According to this picture, taken from http://lartc.org/lartc.html, I thought I could set the marks in FORWARD and INPUT, but that didn't work at all. The traffic ends up in imq0 as it should, but only goes to the default class. Moving the '-j IMQ' to the INPUT and FORWARD tables didn't work either. What have I done wrong?

        +------------+                +---------+
+-------------+
> Packet -| PREROUTING |--- routing-----| FORWARD |-------+-------|
POSTROUTING |- Packets
> input   +------------+    decision    +---------+       |
+-------------+    out
>                              |                          |
>                        +-------+                    +--------+
>                        | INPUT |---- Local process -| OUTPUT |
>                        +-------+                    +--------+
Quoted 2 lines

iptables -t mangle -A INPUT -i $EXTERNAL_INTERFACE -p tcp -j

MARK --set-mark 0x1

Quoted 1 line

iptables -t mangle -A FORWARD -i $EXTERNAL_INTERFACE -p tcp -j

MARK --set-mark 0x2

Quoted 8 lines

iptables -t mangle -A PREROUTING -i $EXTERNAL_INTERFACE -j IMQ

/Basic

_______________________________________________
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/