By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,614 Members | 1,680 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,614 IT Pros & Developers. It's quick & easy.

QOS tc problems

P: n/a
I wrote this script for my QOS traffic.
I only care about my VOIP service.
Rest will fight for the bandwidth.

my script:

#!/bin/bash

echo 1 > /proc/sys/net/ipv4/ip_forward

/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

#this is my max upload speed
CEIL=200

if [ "$1" = "stop" ]; then

TCOP="del"
IPTOP="-D"

else

TCOP="add"
IPTOP="-A"

fi
#I give 90 for VOIP streams and 110kbits for rest
tc qdisc ${TCOP} dev eth0 root handle 1: htb default 20
tc class ${TCOP} dev eth0 parent 1: classid 1:1 htb rate 200kbit ceil ${CEIL}kbit

tc class ${TCOP} dev eth0 parent 1:1 classid 1:10 htb rate 90kbit ceil ${CEIL}kbit prio 1
tc class ${TCOP} dev eth0 parent 1:1 classid 1:20 htb rate 110kbit ceil ${CEIL}kbit prio 2

tc qdisc ${TCOP} dev eth0 parent 1:10 handle 10: pfifo

#this works instead of next line
#tc filter ${TCOP} dev eth0 parent 1:0 protocol ip prio 1 u32 match ip sport 4569 0xffff flowid 1:10
tc filter ${TCOP} dev eth0 parent 1:0 protocol ip prio 1 handle 1 fw classid 1:10
tc filter ${TCOP} dev eth0 parent 1:0 protocol ip prio 4 handle 4 fw classid 1:20

# IAX2 prio 0.
iptables -t mangle ${IPTOP} PREROUTING -p udp -m udp --dport 4569 -j MARK --set-mark 0x1
iptables -t mangle ${IPTOP} PREROUTING -p udp -m udp --dport 4569 -j RETURN

# everything else lowest priority
iptables -t mangle ${IPTOP} PREROUTING -j MARK --set-mark 0x4
iptables -t mangle ${IPTOP} OUTPUT -j MARK --set-mark 0x4

My problem is that the packets which are supposed to be marked as 0x1
do not go to the 1:10 class. They go to 1:20 which is the default.
Is it possibble that the packets are not marked.
Also, when I change this line
tc filter ${TCOP} dev eth0 parent 1:0 protocol ip prio 1 handle 1 fw classid 1:10
for this
tc filter ${TCOP} dev eth0 parent 1:0 protocol ip prio 1 u32 match ip sport 4569 0xffff flowid 1:10

everything works fine.

Please help.
Looks like I dont do the packet marking correctly.

Thanks

Bart,

Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.