[LARTC] Marking

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux