Prioritising OSPF Packets

92 views Asked by At

I have to give a high priority to OSPF packets so that I do not lose the route and re-initiate. There is too much traffic that it smothers OSPF packets and the device ends up losing the route.

The fact that the data rate will be varying every X seconds, I wished not to use any data rate boundaries. I have tried 3 things:

1 I have tried setting up a prio hierarchy using tc (traffic control) as below, but there was zero data rate for some reason:

    qdisc add dev $INTERFACE root handle 1: prio bands 4 priomap 2 3 2 2 3 3 3 3 1 1 1 1 2 2 2 2
       qdisc add dev $INTERFACE parent 1:1 handle 10: sfq
       qdisc add dev $INTERFACE parent 1:2 handle 20: sfq
       qdisc add dev $INTERFACE parent 1:3 handle 30: sfq
       #I have also tried limiting the packets with limit 50 but still no luck
       qdisc add dev $INTERFACE parent 1:4 handle 40: sfq
    filter add dev $INTERFACE protocol ip parent 1: prio 0 u32 match ip protocol 0x59 0xff flowid 1:1

1:1 has my OSPF packets, and most of the traffic goes into 1:3 in the above example.

I have initially used the above sfq leaf classes then changed the leaf class for most of my traffic goes into qdisc add dev $INTERFACE parent 1:3 handle 30: tbf rate 350kbit -- NOTE: The data rate I had for this connection is 370 kbps at max. But no change in results, still lots of packets being lost.

2 Then I proceeded into defining htb buckets - which I do not prefer for the reason given in my first paragraph:

qdisc add dev $INTERFACE root handle 1: htb default 20
    class add dev $INTERFACE parent 1: classid 1:1 htb rate 7Mbit burst 15k
        class add dev $INTERFACE parent 1:1 classid 1:10 htb rate 10kbit burst 15k prio 1
        class add dev $INTERFACE parent 1:1 classid 1:20 htb rate 320kbit ceil 360kbit burst 15k prio 5
            qdisc add dev $INTERFACE parent 1:10 handle 10: sfq
            qdisc add dev $INTERFACE parent 1:20 handle 20: sfq
filter add dev $INTERFACE protocol ip parent 1: prio 0 u32 match ip protocol 0x59 0xff flowid 1:10

I don't think there is an option with htb to say: give class A, X kbps and leave the rest of the available bandwidth to class B, is there?

That's why I had to give something small to the class where I put my OSPF packets into (10kbit above) and 320kbit guarantee to the other class, and set the overall datarate to 7Mbps because that's the highest this network can ever have.

The data rate seemed to act normal with this setting but after about 65 seconds immense packet losses occur up to 85-90%.

3 I have removed all the QoS rules and tried setting the Minimise Delay TOS via iptables:

iptables --table mangle --append PREROUTING --protocol OSPF -j TOS --set-tos 0x10

And it makes my device crash.

1

There are 1 answers

0
Davit Hovhannisyan On

Your TC setup seems reasonable but there might be an issue with packet matching criteria, or with the organization of classes. I would recommend you to use "htb" instead of "sfq" for better control.

tc qdisc add dev $INTERFACE root handle 1: htb default 10
tc class add dev $INTERFACE parent 1: classid 1:1 htb rate 10kbit ceil 10kbit
tc class add dev $INTERFACE parent 1:1 classid 1:10 htb rate 370kbit ceil 370kbit
tc filter add dev $INTERFACE protocol ip parent 1: prio 1 u32 match ip protocol 0x59 0xff flowid 1:10