All of lore.kernel.org
 help / color / mirror / Atom feed
* [LARTC] Marking
@ 2002-03-20 21:14 Ali badilli
  2002-03-21 21:06 ` Viktor Kemmet
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Ali badilli @ 2002-03-20 21:14 UTC (permalink / raw)
  To: lartc

Hi everybody,

Does anybody know any tool, we can mark packets' ToS
field?. I would like to mark packets in ingress router
and classify them in core router based on their ToS
field (DSCP in Diffserv). 

Thanks in advance


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [LARTC] Marking
  2002-03-20 21:14 [LARTC] Marking Ali badilli
@ 2002-03-21 21:06 ` Viktor Kemmet
  2003-01-27  4:50 ` [LARTC] marking Jay Wineinger
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Viktor Kemmet @ 2002-03-21 21:06 UTC (permalink / raw)
  To: lartc


Ali badilli wrote:

> Hi everybody,
> 
> Does anybody know any tool, we can mark packets' ToS
> field?. I would like to mark packets in ingress router
> and classify them in core router based on their ToS
> field (DSCP in Diffserv). 
> 
> Thanks in advance
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Sports - live college hoops coverage
> http://sports.yahoo.com/
> _______________________________________________
> LARTC mailing list / LARTC@mailman.ds9a.nl
> http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
> 
> 

Have you tried iptables:
(see man-page for iptables)
iptables -A OUTPUT -t mangle -p tcp --sport telnet \
   -j TOS --set-tos Minimize-Delay



Or you can do it with tc:
(setting TOS according to destination port)

TC=tc
EGDEV="dev eth0"
#
#
############################################################
######################## Egress side ########################
# attach a dsmarker
#
$TC qdisc add $EGDEV handle 1:0 root dsmark indices 64 set_tc_index
#
# values of the DSCP to change depending on the class
#
#becomes EF
$TC class change $EGDEV classid 1:1 dsmark mask 0x3 \
        value 0xb8
#becomes AF11
$TC class change $EGDEV classid 1:2 dsmark mask 0x3 \
        value 0x28
#becomes AF21
$TC class change $EGDEV classid 1:3 dsmark mask 0x3 \
        value 0x48
#
#
# The class mapping
#
$TC filter add $EGDEV parent 1:0 protocol ip prio 4 u32 \
     match ip dport 5001 0xffff classid 1:1
$TC filter add $EGDEV parent 1:0 protocol ip prio 4 u32 \
     match ip dport 5002 0xffff classid 1:2
$TC filter add $EGDEV parent 1:0 protocol ip prio 4 u32 \
     match ip dport 5003 0xffff  classid 1:3
#

echo "---- qdisc parameters Egress  ----------"
$TC qdisc ls $EGDEV
echo "---- Class parameters Egress  ----------"
$TC class ls $EGDEV
echo "---- filter parameters Egress ----------"
$TC filter ls $EGDEV parent 1:0



Just for testing, ping and mgen can set TOS field as well.

Regards
Viktor

_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [LARTC] marking
  2002-03-20 21:14 [LARTC] Marking Ali badilli
  2002-03-21 21:06 ` Viktor Kemmet
@ 2003-01-27  4:50 ` Jay Wineinger
  2003-01-27 18:17 ` Stef Coene
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Jay Wineinger @ 2003-01-27  4:50 UTC (permalink / raw)
  To: lartc

Im kind of confused as to where I need to mark packets with my setup.  I
have a linux router serving an internal subnet (eth1) whose http/https
traffic goes through a squid proxy on the same box.  Can someone tell me
where I would need to insert marking rules so that all packets get properly
filtered, whether sourced from the internal subnet or the local server?
Also, are there any restrictions on what values are used for marking? (ie,
do they have to be powers of 2 or anything?).


Thanks,
Jay

_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [LARTC] marking
  2002-03-20 21:14 [LARTC] Marking Ali badilli
  2002-03-21 21:06 ` Viktor Kemmet
  2003-01-27  4:50 ` [LARTC] marking Jay Wineinger
@ 2003-01-27 18:17 ` Stef Coene
  2003-01-28  3:55 ` Jay Wineinger
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Stef Coene @ 2003-01-27 18:17 UTC (permalink / raw)
  To: lartc

On Monday 27 January 2003 05:50, Jay Wineinger wrote:
> Im kind of confused as to where I need to mark packets with my setup.  I
> have a linux router serving an internal subnet (eth1) whose http/https
> traffic goes through a squid proxy on the same box.  Can someone tell me
> where I would need to insert marking rules so that all packets get properly
> filtered, whether sourced from the internal subnet or the local server?
> Also, are there any restrictions on what values are used for marking? (ie,
> do they have to be powers of 2 or anything?).
Marking van be any hex number between 0 and ffff (more or less).
It's not clear to me how your setup look like and what you want to do.

Stef

-- 

stef.coene@docum.org
 "Using Linux as bandwidth manager"
     http://www.docum.org/
     #lartc @ irc.oftc.net

_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [LARTC] marking
  2002-03-20 21:14 [LARTC] Marking Ali badilli
                   ` (2 preceding siblings ...)
  2003-01-27 18:17 ` Stef Coene
@ 2003-01-28  3:55 ` Jay Wineinger
  2003-01-28  9:52 ` Stef Coene
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Jay Wineinger @ 2003-01-28  3:55 UTC (permalink / raw)
  To: lartc

> It's not clear to me how your setup look like and what you want to do.
>
> Stef
>

Ok, what I want to do is setup 4 or 5 classes for traffic headed out my
external interface(eth0).  They should be something like interactive (icmp,
ssh, etc), mail (smpt,pop,imap), web (http/https), and bulk.   My problem
right now is figuring out the correct configuration so that I do not limit
traffic that is only destined FOR the QoS box, which also does DHCP, nat,
samba, etc for the internal nat'd subnet (eth1).  I also run a squid caching
proxy server for the network's http/https connections.

Im having trouble figuring where the correct place to mark each packet would
be. Do i need to do some in -t mangle PREROUTING or INPUT or FORWARD?  Im
confused as to how to differentiate between packets destined for the outside
world (out eth0) and those that are staying on the internal network.

This is what Ive pulled out of my butt for my qdisc setup:

# Create new root qdisc on eth1 and parent for everything
$TC qdisc add dev eth1 root handle 1: htb default 2022
$TC class add dev eth1 parent 1: classid 1:1 htb rate 95mbit ceil 95mbit

# Create parent class for outbound
$TC class add dev eth1 parent 1:1 classid 1:10 htb rate 350kbps burst 2k
ceil 350kbps
  # Create subclasses on outbound traffic for interactive,mail,www,bulk
  $TC class add dev eth1 parent 1:10 classid 1:101 htb rate 50kbps burst 2k
prio 0    [interactive]
  $TC class add dev eth1 parent 1:10 classid 1:102 htb rate 50kbps burst 2k
prio 1    [mail]
  $TC class add dev eth1 parent 1:10 classid 1:103 htb rate 50kbps burst 5k
prio 2    [ www is limited farther upstream anyway =(   ]
  $TC class add dev eth1 parent 1:10 classid 1:104 htb rate 70kbps burst 2k
prio 3 ceil 125kbps    [bulk]

# Create parent class for internal subnet traffic
$TC class add dev eth1 parent 1:1 classid 1:20 htb rate 60mbit ceil 90mbit
  # Create subclasses on internal traffic for interactive and bulk traffic
  $TC class add dev eth1 parent 1:20 classid 1:201 htb rate 150kbps burst 2k
prio 0    [local interactive]
  $TC class add dev eth1 parent 1:20 classid 1:202 htb rate 50mbit prio 1
ceil 55mbit
    # Create subclasses on internal bulk traffic (1:202) for www and other
    $TC class add dev eth1 parent 1:202 classid 1:2021 htb rate 25mbit prio
0    [local webserver traffic]
    $TC class add dev eth1 parent 1:202 classid 1:2022 htb rate 25mbit prio
1    [bulk]

Am i going about this all wrong?

thanks for any help/suggestions
jay





_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [LARTC] marking
  2002-03-20 21:14 [LARTC] Marking Ali badilli
                   ` (3 preceding siblings ...)
  2003-01-28  3:55 ` Jay Wineinger
@ 2003-01-28  9:52 ` Stef Coene
  2003-01-28 19:56 ` Stef Coene
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Stef Coene @ 2003-01-28  9:52 UTC (permalink / raw)
  To: lartc

On Tuesday 28 January 2003 09:29, Don Cohen wrote:
>   Marking van be any hex number between 0 and ffff (more or less).
>         unsigned long   nfmark;
> isn't that 32 bits?

I think I created some confusion.  You can use the mark as hash key with the 
fw filter.  So packets marked with 10 are redirected to class x:10.  And the 
class names are a number between 0 ans ffff.
So the mark itself can be 32 bits.

Stef

-- 

stef.coene@docum.org
 "Using Linux as bandwidth manager"
     http://www.docum.org/
     #lartc @ irc.oftc.net

_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [LARTC] marking
  2002-03-20 21:14 [LARTC] Marking Ali badilli
                   ` (4 preceding siblings ...)
  2003-01-28  9:52 ` Stef Coene
@ 2003-01-28 19:56 ` Stef Coene
  2003-01-28 21:47 ` Jay Wineinger
  2003-01-29 17:33 ` Stef Coene
  7 siblings, 0 replies; 9+ messages in thread
From: Stef Coene @ 2003-01-28 19:56 UTC (permalink / raw)
  To: lartc

On Tuesday 28 January 2003 04:55, Jay Wineinger wrote:
> > It's not clear to me how your setup look like and what you want to do.
> >
> > Stef
>
> Ok, what I want to do is setup 4 or 5 classes for traffic headed out my
> external interface(eth0).  They should be something like interactive (icmp,
> ssh, etc), mail (smpt,pop,imap), web (http/https), and bulk.   My problem
> right now is figuring out the correct configuration so that I do not limit
> traffic that is only destined FOR the QoS box, which also does DHCP, nat,
> samba, etc for the internal nat'd subnet (eth1).  I also run a squid
> caching proxy server for the network's http/https connections.
>
> Im having trouble figuring where the correct place to mark each packet
> would be. Do i need to do some in -t mangle PREROUTING or INPUT or FORWARD?
>  Im confused as to how to differentiate between packets destined for the
> outside world (out eth0) and those that are staying on the internal
> network.
Maybe the KPTD on www.docum.org can help you to figure out where you can mark 
the packets.

> This is what Ive pulled out of my butt for my qdisc setup:
>
> # Create new root qdisc on eth1 and parent for everything
> $TC qdisc add dev eth1 root handle 1: htb default 2022
> $TC class add dev eth1 parent 1: classid 1:1 htb rate 95mbit ceil 95mbit
>
> # Create parent class for outbound
> $TC class add dev eth1 parent 1:1 classid 1:10 htb rate 350kbps burst 2k
> ceil 350kbps
>   # Create subclasses on outbound traffic for interactive,mail,www,bulk
>   $TC class add dev eth1 parent 1:10 classid 1:101 htb rate 50kbps burst 2k
> prio 0    [interactive]
>   $TC class add dev eth1 parent 1:10 classid 1:102 htb rate 50kbps burst 2k
> prio 1    [mail]
>   $TC class add dev eth1 parent 1:10 classid 1:103 htb rate 50kbps burst 5k
> prio 2    [ www is limited farther upstream anyway =(   ]
>   $TC class add dev eth1 parent 1:10 classid 1:104 htb rate 70kbps burst 2k
> prio 3 ceil 125kbps    [bulk]
>
> # Create parent class for internal subnet traffic
> $TC class add dev eth1 parent 1:1 classid 1:20 htb rate 60mbit ceil 90mbit
>   # Create subclasses on internal traffic for interactive and bulk traffic
>   $TC class add dev eth1 parent 1:20 classid 1:201 htb rate 150kbps burst
> 2k prio 0    [local interactive]
>   $TC class add dev eth1 parent 1:20 classid 1:202 htb rate 50mbit prio 1
> ceil 55mbit
>     # Create subclasses on internal bulk traffic (1:202) for www and other
>     $TC class add dev eth1 parent 1:202 classid 1:2021 htb rate 25mbit prio
> 0    [local webserver traffic]
>     $TC class add dev eth1 parent 1:202 classid 1:2022 htb rate 25mbit prio
> 1    [bulk]
>
> Am i going about this all wrong?
No.  
But I have some remarks.  Since you don't specify the ceil parameter, ceil = 
rate.  So the classes can't borrow unused bandwidth to each other.  Is that 
what you want?  (see classes 101, 102, 103, 104).

Stef

-- 

stef.coene@docum.org
 "Using Linux as bandwidth manager"
     http://www.docum.org/
     #lartc @ irc.oftc.net

_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [LARTC] marking
  2002-03-20 21:14 [LARTC] Marking Ali badilli
                   ` (5 preceding siblings ...)
  2003-01-28 19:56 ` Stef Coene
@ 2003-01-28 21:47 ` Jay Wineinger
  2003-01-29 17:33 ` Stef Coene
  7 siblings, 0 replies; 9+ messages in thread
From: Jay Wineinger @ 2003-01-28 21:47 UTC (permalink / raw)
  To: lartc

Ok, that KPTD helps a bit.  Question about that though, it seems that a
forwarded packet will have 3 chances at getting marked (PRE,FORWARD,POST);
is that correct?  Similarly, a packet originating on the QoS box will have 2
mark chances (OUTPUT and POST).   If thats correct, is there any advantage
to using one or the other. I dont see why you wouldnt just do everything in
POSTROUTING since all packets go there eventually according to the diagram.

btw, thanks for all the help

_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [LARTC] marking
  2002-03-20 21:14 [LARTC] Marking Ali badilli
                   ` (6 preceding siblings ...)
  2003-01-28 21:47 ` Jay Wineinger
@ 2003-01-29 17:33 ` Stef Coene
  7 siblings, 0 replies; 9+ messages in thread
From: Stef Coene @ 2003-01-29 17:33 UTC (permalink / raw)
  To: lartc

On Tuesday 28 January 2003 22:47, Jay Wineinger wrote:
> Ok, that KPTD helps a bit.  Question about that though, it seems that a
> forwarded packet will have 3 chances at getting marked (PRE,FORWARD,POST);
> is that correct?  Similarly, a packet originating on the QoS box will have
> 2 mark chances (OUTPUT and POST).   If thats correct, is there any
> advantage to using one or the other. I dont see why you wouldnt just do
> everything in POSTROUTING since all packets go there eventually according
> to the diagram.
I always mark in PREROUTING.  Don't ask me why.  But if you want to mark in 
POSTROUTING, why not?

Stef

PS I have problems sending you an email :
Domain wnoc.com not found ???

Stef

-- 

stef.coene@docum.org
 "Using Linux as bandwidth manager"
     http://www.docum.org/
     #lartc @ irc.oftc.net

_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2003-01-29 17:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-03-20 21:14 [LARTC] Marking Ali badilli
2002-03-21 21:06 ` Viktor Kemmet
2003-01-27  4:50 ` [LARTC] marking Jay Wineinger
2003-01-27 18:17 ` Stef Coene
2003-01-28  3:55 ` Jay Wineinger
2003-01-28  9:52 ` Stef Coene
2003-01-28 19:56 ` Stef Coene
2003-01-28 21:47 ` Jay Wineinger
2003-01-29 17:33 ` Stef Coene

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.