You are not logged in.

#1 2017-10-03 17:49:26

msalerno
Member
Registered: 2014-08-15
Posts: 32

TC and bandwidth limiting - How to exclude specific host?

Situation:
I am running a lab and I need to test a few servers with degraded bandwidth.   Each system runs a monitoring agent that reports back to a monitoring server.

Objective:
Limit all inbound and outbound traffic to 56kbps unless it's to or from the monitoring server

What I have:

tc qdisc add dev eth0 handle 1: root htb default 11
tc class add dev eth0 parent 1: classid 1:1 htb rate 56kbps
tc class add dev eth0 parent 1:1 classid 1:11 htb rate 56kbps

This will limit all I/O network traffic on the system to 56kbps and it works well.

The problem is that I need to exclude the monitoring server and i'm having issues setting up filters.

I want to create a queue that does not limit bandwidth and the assign the monitoring server to it, but i'm lost.

I've been going through the documentation for quite some time, every piece of documentation covers setting up multiple queues but with bandwidth limitations.

Can someone offer some guidance?

Thanks

Last edited by msalerno (2017-10-03 17:50:06)

Offline

#2 2017-10-03 17:56:59

frostschutz
Member
Registered: 2013-11-15
Posts: 1,417

Re: TC and bandwidth limiting - How to exclude specific host?

You'd have to give the root class 1:1 a higher rate, and add another leaf class (1:10 or 1:12 or whatever you like) that is actually allowed to use it, then filter your controller in that class.

HTB might be bad/inaccurate at scheduling if there is a very low (56kbit) and a very high bandwidth (100MBit-1GBit) class at the same time. Maybe HFSC is better in that regard.

As for bypassing the HTB qdisc entire, I'm not sure if there is a way to do that, other than using something other than HTB as root qdisc (like PRIO with custom priomap) and HTB only as a subsidiary.

A completely different approach would be to add another network interface.

Offline

#3 2017-10-03 20:31:05

msalerno
Member
Registered: 2014-08-15
Posts: 32

Re: TC and bandwidth limiting - How to exclude specific host?

I'm going to stick with HTB until I have a working solution and better understanding of how to set this up.   You are 100% right that the correct approach is to setup another NIC specifically for management, but since this is a small VM and Container based lab that's all on the same subnet, it would be a difficult task.  I'm also a complete idiot!  All inbound traffic comes in to the servers via a load balancer.  There's no need to include all, exclude one.

tc qdisc add dev eth0 handle 1: root htb 
tc class add dev eth0 parent 1: classid 1:1 htb rate 56kbps
tc class add dev eth0 parent 1:1 classid 1:2 htb rate 56kbps
tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32 match ip dst 172.18.0.17/32 flowid 1:1
tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32 match ip src 172.18.0.17/32 flowid 1:2

Would it be possible to get a sanity check?

Thanks

Offline

Board footer

Powered by FluxBB