Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a tc filter rule:

tc filter add dev eth0 protocol ip prio 1 u32 match ip dst 10.0.0.3 flowid 1:14

if I try to 'change' this filter rule I get an error:

# tc filter change dev eth0 protocol ip prio 1 u32 match ip dst 10.0.0.2 flowid 1:14
# RTNETLINK answers: No such file or directory
# We have an error talking to the kernel

'replace' adds a new, but don't remove the old rule.

is the syntax of the replace/change command correct?

CentOS 6.4 iptables-1.4.7-9.el6.x86_64 iproute-2.6.32-23.el6.x86_64

a full script:

tc qdisc add dev eth0 root handle 1: htb

tc class add dev eth0 parent 1: classid 1:1 htb rate 1000Mbps

tc class add dev eth0 parent 1:1 classid 1:11 htb rate 100Mbps
tc class add dev eth0 parent 1:1 classid 1:12 htb rate 100Mbps
tc class add dev eth0 parent 1:1 classid 1:13 htb rate 100Mbps
tc class add dev eth0 parent 1:1 classid 1:14 htb rate 100Mbps

tc qdisc add dev eth0 parent 1:11 handle 10: netem delay 0ms
tc qdisc add dev eth0 parent 1:12 handle 20: netem delay 500ms
tc qdisc add dev eth0 parent 1:13 handle 30: netem delay 1000ms
tc qdisc add dev eth0 parent 1:14 handle 40: netem delay 1500ms

tc filter add dev eth0 protocol ip prio 1 u32 match ip dst 10.0.0.3 flowid 1:11
tc filter add dev eth0 protocol ip prio 1 u32 match ip dst 10.0.0.8 flowid 1:12
tc filter add dev eth0 protocol ip prio 1 u32 match ip dst 10.0.0.9 flowid 1:13
tc filter add dev eth0 protocol ip prio 1 u32 match ip dst 10.0.0.7 flowid 1:14
share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

I think you have to use handle for that, like this:

sudo tc filter change dev eth0 pref 1 protocol ip handle 800::800 u32 match ip dst 10.0.0.5 flowid 1:15

— this way I can issue the same command with different ip dst and it applies successfully.

P. S. Handles are shown with tc show, or, I believe you can specify them when adding rules for the first time.

share|improve this answer
    
thx @poige, it works now if I specify handle. I can modify only a filter parameters, not the match, right? tc filter replace dev eth0 protocol ip prio 1 handle 800::807 u32 match ip dst 1.1.1.2 match ip dport 53 0xffff flowid 1:14 - doesn't change the IP address in the match expression. –  user174704 May 22 '13 at 14:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.