Skip to contentSkip to conversation

Whats wrong with my script?

LARTC Gastón 3 participants 7 messages Jan 27, 2004 – Feb 1, 2004

lore
Share & tools
lore

Gastón

author
#0 lore raw

I`m trying to shape both upload (eth0) and download(eth1). I made this script to acomplishthis but the filters are not working even though the classes and qdiscs are created. What am I doing wrong? #!/bin/bash

tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1 htb default 10 r2q 5

tc qdisc del dev eth1 root
tc qdisc add dev eth1 root handle 1 htb default 10 r2q 5

tc class add dev eth0 parent 1: classid 1:2 htb rate 5Mbit burst 15k

tc class add dev eth0 parent 1:2 classid 1:59 htb rate 64Kbit ceil 64Kbit tc qdisc add dev eth0 parent 1:59 handle 59 sfq perturb 10
tc filter add dev eth0 parent 1:0 protocol ip prio 100 u32 match ip src 192.168.0.50 classid 1:59

tc class add dev eth1 parent 1: classid 1:2 htb rate 5Mbit burst 15k

tc class add dev eth1 parent 1:2 classid 1:56 htb rate 64Kbit ceil 64Kbit tc qdisc add dev eth1 parent 1:56 handle 56 sfq perturb 10
tc filter add dev eth1 parent 1:0 protocol ip prio 100 u32 match ip dst 192.168.0.50 classid 1:56

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

#1 lore raw

Hello,

According with rules you are controlling only download (src ip) you should add a (dst rule) also. Make a try.

[]'s
Anderson

Quoted 1 line

I`m trying to shape both upload (eth0) and download

(eth1). I made this

Quoted 1 line

script to acomplishthis but the filters are not working

even though the

Quoted 1 line

classes and qdiscs are created. What am I doing wrong?

#!/bin/bash

Quoted 4 lines

tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1 htb default 10 r2q

5

Quoted 3 lines

tc qdisc del dev eth1 root
tc qdisc add dev eth1 root handle 1 htb default 10 r2q

5

Quoted 2 lines

tc class add dev eth0 parent 1: classid 1:2 htb rate 5M

bit burst 15k

Quoted 2 lines

tc class add dev eth0 parent 1:2 classid 1:59 htb rate

64Kbit ceil 64Kbit

Quoted 1 line

tc qdisc add dev eth0 parent 1:59 handle 59 sfq perturb

10

Quoted 1 line

tc filter add dev eth0 parent 1:0 protocol ip prio 100

u32 match ip src

Quoted 3 lines

192.168.0.50 classid 1:59

tc class add dev eth1 parent 1: classid 1:2 htb rate 5M

bit burst 15k

Quoted 2 lines

tc class add dev eth1 parent 1:2 classid 1:56 htb rate

64Kbit ceil 64Kbit

Quoted 1 line

tc qdisc add dev eth1 parent 1:56 handle 56 sfq perturb

10

Quoted 1 line

tc filter add dev eth1 parent 1:0 protocol ip prio 100

u32 match ip dst

Quoted 6 lines

192.168.0.50 classid 1:56

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

tp://lartc.org/

Quoted 1 line

__________________________________________________________________________
Acabe com aquelas janelinhas que pulam na sua tela. AntiPop-up UOL - É grátis!
http://antipopup.uol.com.br/

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

author
#2 lore raw
In reply to Gastón

What about this? : tc filter add dev eth1 parent 1:0 protocol ip prio 100 u32 match ip dst 192.168.0.50 classid 1:56
Is this correct for shaping upload?

----- Original Message -----
From: "andybr" <[email protected]>
To: <[email protected]>
Cc: <[email protected]>
Sent: Thursday, January 29, 2004 10:05 AM
Subject: Re:[LARTC] Whats wrong with my script?

Hello,

According with rules you are controlling only download (src ip) you should add a (dst rule) also. Make a try.

[]'s
Anderson

Quoted 1 line

I`m trying to shape both upload (eth0) and download

(eth1). I made this

Quoted 1 line

script to acomplishthis but the filters are not working

even though the

Quoted 1 line

classes and qdiscs are created. What am I doing wrong?

#!/bin/bash

Quoted 4 lines

tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1 htb default 10 r2q

5

Quoted 3 lines

tc qdisc del dev eth1 root
tc qdisc add dev eth1 root handle 1 htb default 10 r2q

5

Quoted 2 lines

tc class add dev eth0 parent 1: classid 1:2 htb rate 5M

bit burst 15k

Quoted 2 lines

tc class add dev eth0 parent 1:2 classid 1:59 htb rate

64Kbit ceil 64Kbit

Quoted 1 line

tc qdisc add dev eth0 parent 1:59 handle 59 sfq perturb

10

Quoted 1 line

tc filter add dev eth0 parent 1:0 protocol ip prio 100

u32 match ip src

Quoted 3 lines

192.168.0.50 classid 1:59

tc class add dev eth1 parent 1: classid 1:2 htb rate 5M

bit burst 15k

Quoted 2 lines

tc class add dev eth1 parent 1:2 classid 1:56 htb rate

64Kbit ceil 64Kbit

Quoted 1 line

tc qdisc add dev eth1 parent 1:56 handle 56 sfq perturb

10

Quoted 1 line

tc filter add dev eth1 parent 1:0 protocol ip prio 100

u32 match ip dst

Quoted 6 lines

192.168.0.50 classid 1:56

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

tp://lartc.org/

Quoted 1 line

__________________________________________________________________________
Acabe com aquelas janelinhas que pulam na sua tela. AntiPop-up UOL - É grátis!
http://antipopup.uol.com.br/

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

#3 lore raw
In reply to Gastón
Quoted 3 lines · Gastón

What about this? : tc filter add dev eth1 parent 1:0 protocol ip prio 100 u32 match ip dst 192.168.0.50 classid 1:56
Is this correct for shaping upload?

On your upload (eth0) interface, you can't use private IPs, because they've already been natted to real ones (see http://www.docum.org/stef.coene/qos/kptd/ ) If you want to shape outbound traffic based on private-lan IP, you need to mark the packets with iptables, then filter based on mark.
(There are lots of examples of this in the doco and mail archives).

Your download rules seem correct enough.

regards,

Quoted 101 lines

----- Original Message -----
From: "andybr" <[email protected]>
To: <[email protected]>
Cc: <[email protected]>
Sent: Thursday, January 29, 2004 10:05 AM
Subject: Re:[LARTC] Whats wrong with my script?

Hello,

According with rules you are controlling only download (src ip) you should add a (dst rule) also. Make a try.

[]'s
Anderson

Quoted 1 line

I`m trying to shape both upload (eth0) and download

(eth1). I made this

Quoted 1 line

script to acomplishthis but the filters are not working

even though the

Quoted 1 line

classes and qdiscs are created. What am I doing wrong?

#!/bin/bash

Quoted 3 lines

tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1 htb default 10 r2q

5

Quoted 2 lines

tc qdisc del dev eth1 root
tc qdisc add dev eth1 root handle 1 htb default 10 r2q

5

Quoted 1 line

tc class add dev eth0 parent 1: classid 1:2 htb rate 5M

bit burst 15k

Quoted 1 line

tc class add dev eth0 parent 1:2 classid 1:59 htb rate

64Kbit ceil 64Kbit

Quoted 1 line

tc qdisc add dev eth0 parent 1:59 handle 59 sfq perturb

10

Quoted 1 line

tc filter add dev eth0 parent 1:0 protocol ip prio 100

u32 match ip src

Quoted 3 lines

192.168.0.50 classid 1:59

tc class add dev eth1 parent 1: classid 1:2 htb rate 5M

bit burst 15k

Quoted 1 line

tc class add dev eth1 parent 1:2 classid 1:56 htb rate

64Kbit ceil 64Kbit

Quoted 1 line

tc qdisc add dev eth1 parent 1:56 handle 56 sfq perturb

10

Quoted 1 line

tc filter add dev eth1 parent 1:0 protocol ip prio 100

u32 match ip dst

Quoted 6 lines

192.168.0.50 classid 1:56

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

tp://lartc.org/

__________________________________________________________________________
Acabe com aquelas janelinhas que pulam na sua tela. AntiPop-up UOL - É grátis!
http://antipopup.uol.com.br/

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

Signature · 11 lines
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Damion de Soto - Software Engineer  email:     [email protected]
SnapGear - A CyberGuard Company ---    ph:         +61 7 3435 2809
  | Custom Embedded Solutions          fax:         +61 7 3891 3630
  | and Security Appliances            web: http://www.snapgear.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ---  Free Embedded Linux Distro at   http://www.snapgear.org  ---

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
author
#4 lore raw
In reply to Gastón

What if I use public, routable IPs? i.e eth0: public eth1: public and client`s ips also public.

----- Original Message -----
From: "Damion de Soto" <[email protected]>
To: "Gastón" <[email protected]>
Cc: <[email protected]>
Sent: Friday, January 30, 2004 4:16 AM
Subject: Re: [LARTC] Whats wrong with my script?

Quoted 2 lines
Quoted 1 line · Gastón

What about this? : tc filter add dev eth1 parent 1:0 protocol ip prio

100

Quoted 3 lines
Quoted 2 lines

u32 match ip dst 192.168.0.50 classid 1:56
Is this correct for shaping upload?

On your upload (eth0) interface, you can't use private IPs, because

they've already

Quoted 2 lines

been natted to real ones (see http://www.docum.org/stef.coene/qos/kptd/ ) If you want to shape outbound traffic based on private-lan IP, you need to

mark the

Quoted 6 lines

packets with iptables, then filter based on mark.
(There are lots of examples of this in the doco and mail archives).

Your download rules seem correct enough.

regards,

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

#5 lore raw
In reply to Gastón

If you want to set upload coming from eth0 for example:
tc filter add eth0 parent 1:0 protocol ip prio 100 u32 match ip src 192.168.0.50 classid 1:56

Try and let us know if it worked.

Anderson

----- Original Message -----
From: "Gastón" <[email protected]>
To: "andybr" <[email protected]>
Cc: <[email protected]>
Sent: Thursday, January 29, 2004 6:19 PM
Subject: Re: Re:[LARTC] Whats wrong with my script?

Quoted 72 lines

What about this? : tc filter add dev eth1 parent 1:0 protocol ip prio 100 u32 match ip dst 192.168.0.50 classid 1:56
Is this correct for shaping upload?

----- Original Message -----
From: "andybr" <[email protected]>
To: <[email protected]>
Cc: <[email protected]>
Sent: Thursday, January 29, 2004 10:05 AM
Subject: Re:[LARTC] Whats wrong with my script?

Hello,

According with rules you are controlling only download (src ip) you should add a (dst rule) also. Make a try.

[]'s
Anderson

Quoted 1 line

I`m trying to shape both upload (eth0) and download

(eth1). I made this

Quoted 1 line

script to acomplishthis but the filters are not working

even though the

Quoted 1 line

classes and qdiscs are created. What am I doing wrong?

#!/bin/bash

Quoted 4 lines

tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1 htb default 10 r2q

5

Quoted 3 lines

tc qdisc del dev eth1 root
tc qdisc add dev eth1 root handle 1 htb default 10 r2q

5

Quoted 2 lines

tc class add dev eth0 parent 1: classid 1:2 htb rate 5M

bit burst 15k

Quoted 2 lines

tc class add dev eth0 parent 1:2 classid 1:59 htb rate

64Kbit ceil 64Kbit

Quoted 1 line

tc qdisc add dev eth0 parent 1:59 handle 59 sfq perturb

10

Quoted 1 line

tc filter add dev eth0 parent 1:0 protocol ip prio 100

u32 match ip src

Quoted 3 lines

192.168.0.50 classid 1:59

tc class add dev eth1 parent 1: classid 1:2 htb rate 5M

bit burst 15k

Quoted 2 lines

tc class add dev eth1 parent 1:2 classid 1:56 htb rate

64Kbit ceil 64Kbit

Quoted 1 line

tc qdisc add dev eth1 parent 1:56 handle 56 sfq perturb

10

Quoted 1 line

tc filter add dev eth1 parent 1:0 protocol ip prio 100

u32 match ip dst

Quoted 6 lines

192.168.0.50 classid 1:56

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

tp://lartc.org/

Quoted 1 line

__________________________________________________________________________
Acabe com aquelas janelinhas que pulam na sua tela. AntiPop-up UOL - É grátis!
http://antipopup.uol.com.br/

Quoted 4 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/

#6 lore raw
In reply to Gastón
Quoted 2 lines · Gastón

What if I use public, routable IPs? i.e eth0: public eth1: public and client`s ips also public.

Yes, you can also do that.
You don't have to though, iptables marking private IP and then filtering on marks works quite fine.

regards,

Signature · 11 lines
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Damion de Soto - Software Engineer  email:     [email protected]
SnapGear - A CyberGuard Company ---    ph:         +61 7 3435 2809
  | Custom Embedded Solutions          fax:         +61 7 3891 3630
  | and Security Appliances            web: http://www.snapgear.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ---  Free Embedded Linux Distro at   http://www.snapgear.org  ---

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