Skip to contentSkip to conversation

beginner question about imq

LARTC Szálka Tamás 4 participants 11 messages Sep 10, 2003 – Sep 12, 2003

lore
Share & tools
lore
#0 lore raw

Hi!

I have to make a firewall which guarantees bandwidth to several clients (both upstream and downstream should be limitied). It has three interfaces, eth0 facing to the internet, eth1 to local network with several ip addresses (different subnets) and eth2 to dmz (webserver). Egress traffic is ok, I set up the tc rules to eth0 and the upstream limiting is fine. But I have to manage bandwidth of downloading too.
While eth0 has one public ip address, the firewall does masquerading to the local subnets (with local ip ranges). So should I set up an imq device on eth1 with iptables mangle through the prerouting chain to do traffic shaping to the subnets? In this case the packets arrive to eth1 already masqueraded (am I right?) and I can limit the ingress traffic of local adresses. Or should I use the imq on eth0? Doesn't it bothers egress shaping? I'm confused a little bit... :-s
Can you help me?

Thanks
Tom

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

#1 lore raw
Quoted 18 lines · Szálka Tamás

Hi!

I have to make a firewall which guarantees bandwidth to several clients (both upstream and downstream should be limitied). It has three interfaces, eth0 facing to the internet, eth1 to local network with several ip addresses (different subnets) and eth2 to dmz (webserver). Egress traffic is ok, I set up the tc rules to eth0 and the upstream limiting is fine. But I have to manage bandwidth of downloading too.
While eth0 has one public ip address, the firewall does masquerading to the local subnets (with local ip ranges). So should I set up an imq device on eth1 with iptables mangle through the prerouting chain to do traffic shaping to the subnets? In this case the packets arrive to eth1 already masqueraded (am I right?) and I can limit the ingress traffic of local adresses. Or should I use the imq on eth0? Doesn't it bothers egress shaping? I'm confused a little bit... :-s Can you help me?

Quoted 3 lines

Thanks
Tom

I feel imq+HTB on eth0 is an ideal solution for ur requirement.

Regards
-Raghu

Quoted 7 lines

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

#2 lore raw
In reply to Szálka Tamás
Quoted 19 lines · you
Quoted 17 lines · Szálka Tamás

Hi!

I have to make a firewall which guarantees bandwidth to several clients (both upstream and downstream should be limitied). It has three interfaces, eth0 facing to the internet, eth1 to local network with several ip addresses (different subnets) and eth2 to dmz (webserver). Egress traffic is ok, I set up the tc rules to eth0 and the upstream limiting is fine. But I have to manage bandwidth of downloading too. While eth0 has one public ip address, the firewall does masquerading to the local subnets (with local ip ranges). So should I set up an imq device on eth1 with iptables mangle through the prerouting chain to do traffic shaping to the subnets? In this case the packets arrive to eth1 already masqueraded (am I right?) and I can limit the ingress traffic of local adresses. Or should I use the imq on eth0? Doesn't it bothers egress shaping? I'm confused a little bit... :-s
Can you help me?

Quoted 6 lines
Quoted 2 lines

Thanks
Tom

I feel imq+HTB on eth0 is an ideal solution for ur requirement.

Regards
-Raghu

I'd like to filter the packages on their SNAT-ed (local) ip addresses. when the package enters the IMQ right after the iptables PREROUTING chain, does it have SNAT-ed ip addresses? As far as I know the SNAT happens in the POSTROUTING chain. Am I wrong? Or am I even more confused? :)

Tom

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

#3 lore raw
In reply to Szálka Tamás
Quoted 24 lines · Szálka Tamás
Quoted 23 lines · you
Quoted 17 lines · Szálka Tamás

Hi!

I have to make a firewall which guarantees bandwidth to several clients (both upstream and downstream should be limitied). It has three interfaces, eth0 facing to the internet, eth1 to local network with several ip addresses (different subnets) and eth2 to dmz (webserver). Egress traffic is ok, I set up the tc rules to eth0 and the upstream limiting is fine. But I have to manage bandwidth of downloading too. While eth0 has one public ip address, the firewall does masquerading to the local subnets (with local ip ranges). So should I set up an imq device on eth1 with iptables mangle through the prerouting chain to do traffic shaping to the subnets? In this case the packets arrive to eth1 already masqueraded (am I right?) and I can limit the ingress traffic of local adresses. Or should I use the imq on eth0? Doesn't it bothers egress shaping? I'm confused a little bit... :-s
Can you help me?

Quoted 2 lines

Thanks
Tom

I feel imq+HTB on eth0 is an ideal solution for ur requirement.

Quoted 7 lines
Quoted 2 lines

Regards
-Raghu

I'd like to filter the packages on their SNAT-ed (local) ip addresses. when the package enters the IMQ right after the iptables PREROUTING chain, does it have SNAT-ed ip addresses? As far as I know the SNAT happens in the POSTROUTING chain. Am I wrong? Or am I even more confused? :)

See
http://www.docum.org/stef.coene/qos/kptd/

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/
#5 lore raw
In reply to Szálka Tamás
Quoted 9 lines
Quoted 5 lines

I'd like to filter the packages on their SNAT-ed (local) ip addresses. when the package enters the IMQ right after the iptables PREROUTING chain, does it have SNAT-ed ip addresses? As far as I know the SNAT happens in the POSTROUTING chain. Am I wrong? Or am I even more confused? :)

See
http://www.docum.org/stef.coene/qos/kptd/

Stef

Stef,

The picture you have in http://www.docum.org/stef.coene/qos/kptd is with (or without) the IMQ NAT patch?

Signature · 5 lines
Toshiro Viera <[email protected]>

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#6 lore raw
In reply to Szálka Tamás
Quoted 9 lines · Toshiro Viera
Quoted 9 lines
Quoted 5 lines

I'd like to filter the packages on their SNAT-ed (local) ip addresses. when the package enters the IMQ right after the iptables PREROUTING chain, does it have SNAT-ed ip addresses? As far as I know the SNAT happens in the POSTROUTING chain. Am I wrong? Or am I even more confused? :)

See
http://www.docum.org/stef.coene/qos/kptd/

Quoted 6 lines
Quoted 1 line

Stef

Stef,

The picture you have in http://www.docum.org/stef.coene/qos/kptd is with (or without) the IMQ NAT patch?

Without. In prerouting, you see that IMQ is before nat.

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/
#7 lore raw
In reply to Szálka Tamás
Quoted 6 lines · you
Quoted 3 lines

The picture you have in http://www.docum.org/stef.coene/qos/kptd is with (or without) the IMQ NAT patch?

Without. In prerouting, you see that IMQ is before nat.

Stef

With the IMQ NAT patch the order is reversed? The filtering on de-masqueraded addresses is only possible, if NAT is b e f o r e IMQ, isn't it? Tom

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

#8 lore raw
In reply to Szálka Tamás
Quoted 11 lines · Szálka Tamás
Quoted 6 lines · you
Quoted 2 lines

The picture you have in http://www.docum.org/stef.coene/qos/kptd is with (or without) the IMQ NAT patch?

Without. In prerouting, you see that IMQ is before nat.

Stef

With the IMQ NAT patch the order is reversed? The filtering on de-masqueraded addresses is only possible, if NAT is b e f o r e IMQ, isn't it? Tom

The nat in prerouting is also reponsible for rewriting the addresses of natted packets. So you want IMQ after nat so the packets entering the imq device have the real ip address.

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/
#9 lore raw
In reply to Szálka Tamás
Quoted 10 lines · you
Quoted 4 lines

With the IMQ NAT patch the order is reversed? The filtering on de-masqueraded addresses is only possible, if NAT is b e f o r e IMQ, isn't it? Tom

The nat in prerouting is also reponsible for rewriting the addresses of natted
packets. So you want IMQ after nat so the packets entering the imq device have the real ip address.

Stef

What do mean by "real ip address"? So when the packet arrives into the imq, the address in the packet is the local (i.e. 10.0.0.x) address? Thanks
Tom

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

#10 lore raw
In reply to Szálka Tamás
Quoted 10 lines · Szálka Tamás
Quoted 9 lines · you
Quoted 3 lines

With the IMQ NAT patch the order is reversed? The filtering on de-masqueraded addresses is only possible, if NAT is b e f o r e IMQ, isn't it? Tom

The nat in prerouting is also reponsible for rewriting the addresses of natted
packets. So you want IMQ after nat so the packets entering the imq device have the real ip address.

Quoted 4 lines
Quoted 1 line

Stef

What do mean by "real ip address"? So when the packet arrives into the imq, the address in the packet is the local (i.e. 10.0.0.x) address?

Yes. At least it should.

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/