Questions tagged [tc]

TC is the linux tool used to manipulate the traffic control functionality in the kernel.

102 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
7 votes
0 answers
921 views

How to limit bandwidth per VPN connection?

I have a StrongSwan (IKEv2) server setup and would like to limit each VPN connection to 512kb/s. After researching I came across tc in Ubuntu. I don't quite understand it and am fighting through the ...
Houman's user avatar
  • 1,565
4 votes
0 answers
1k views

Limiting incoming traffic with tc police

I have a requirement to limit the total incoming traffic to 5mbit. I know this can be achieved by using the following tc command: tc filter add dev eth0 parent ffff: protocol ip u32 match u32 0 0 ...
Shihab Pullissery's user avatar
4 votes
0 answers
3k views

Linux Traffic Controller (Linux tc): hierarchical token bucket (htb) packet queue size

In my Linux router, I am using the following configuration to limit the rate of traffic towards port 44444 of a client in the LAN (client address is 192.168.10.2, connected through the router's eth1 ...
bmarcov's user avatar
  • 41
4 votes
2 answers
2k views

HTB.init / tc behind NAT

I have an Ubuntu 10 box that I'm trying to set up as a bandwidth-shaping router. The machine has one WAN interface, eth0 and two LAN interfaces, eth1 and eth2. NAT is configured using MASQUERADE as ...
Ben K.'s user avatar
  • 2,389
3 votes
0 answers
2k views

Adding some delay to a specific port on localhost using tc and netem

I'm going to simulate a network latency on three different ports of local host by using tc (traffic control for Linux) commands. I run the following code: !/bin/bash tc qdisc add dev lo root handle 1:...
Folani's user avatar
  • 31
3 votes
0 answers
2k views

How to configure per IP bandwidth control using TC?

Requirements: There is an arbitrary number of users per group. Bandwidth for any particular group is 1000kbps. Bandwidth for each user in a group is 70 kbps. At any time no user should not consume ...
techiek7's user avatar
3 votes
1 answer
5k views

How to limit outgoing traffic per IP Address using Linux TC

I want to limit outgoing traffic per IP address. For example I have a network interface eth0, having 1Gbps of bandwidth. I want to limit the whole network interface to 1Mbps each destination IP ...
Hamid Soltani's user avatar
2 votes
1 answer
1k views

Linux traffic control u32 hashtable filters based on MAC address

I am currently working with a traffic shaping Linux node. The rule set has grown to about 2500 hosts, all identified specifically by MAC address. The filter configuration is "basic", meaning ...
axon's user avatar
  • 163
2 votes
0 answers
348 views

tc filter does not apply between a virtual interface and a physical one

I am working on a project aiming at managing a network between several components. For project purpose, we want to test some bad network effects using netem. The used commands are the following ones: $...
Nicolas Brax's user avatar
2 votes
0 answers
1k views

Using tc to delay packets to several ports

After reading several pages like this this and without having a really deep knowledge about the kernel Linux, I am able to filter up to 3 ports using just the three first leaves of the tree. tc qdisc ...
David_helo's user avatar
2 votes
0 answers
711 views

TC Filter With BPF and NFTables Packet Marking

I made a TC BPF ingress program and I want it to process specific packets only marked by NFTables. Here's my NFTables table that marks the specific packets: table ip compressor_tc { chain ...
Christian Deacon's user avatar
2 votes
1 answer
746 views

Unable to set bandwidth limit on ingress wireless interface with netem and ifb

I am trying to limit the bandwidth on the ingress of a wireless interface using an IFB virtual interface. I followed the instructions here Summary of the steps: Bringing up ifb: sudo modprobe ifb ...
bobsaccamano's user avatar
2 votes
0 answers
1k views

Using tc qdisc, class, and filter to limit bandwidth (both ingress and egress) based on DSCP marks

I'm looking to set-up traffic shaping program that limits both incoming and outgoing traffic based on 6-bit DSCP field in IPv4 packet header. The user should be able to specify different rates for ...
dooble's user avatar
  • 21
2 votes
0 answers
4k views

How to undo the effects of a 'tc qdisc change' command?

I am playing with the netem examples from here https://wiki.linuxfoundation.org/networking/netem and I have learned that I can undo the effect of a tc qdisc add command with a similar tc qdisc del ...
AnonymousLurker's user avatar
2 votes
0 answers
135 views

Linux HTB number of levels

Re-modified Linux HTB by adding a single printk message in htb_dequeue function. static struct sk_buff *htb_dequeue(struct Qdisc *sch) { ... original code ... original code for (level = 0;...
Tony Tannous's user avatar
2 votes
1 answer
607 views

Limit traffic on by user OpenVPN server using tc (traffic control)

I run an OpenVPN server with a 1 Gbps bandwidth and I need to limit it to 5 Mbps per user. Searching the internet I've come up to this bash script: $U32 = "tc filter add dev tun0 protocol ip parent ...
DomeWTF's user avatar
  • 127
2 votes
0 answers
457 views

Bandwidth control with TC for clients yet to be connected

I have applied bandwidth control using TC and iptables using this tutorial on my Strongswan VPN server. The bandwidth control works fine ONLY if that specific client is already connected. For example:...
Ajji's user avatar
  • 131
2 votes
0 answers
65 views

Combining tbf with other qdiscs?

It looks like a subset of classless qdiscs can be combined with each other in certain configurations. In fact it doesn't make sense to me that you could not do this, since things like codel will only ...
jdizzle's user avatar
  • 558
2 votes
1 answer
397 views

Can Linux queueing discipline solely to lower latency? Can it be disabled?

i'm learning about queueing discipline as part of tuning the network stack on our carbon-c-relay cluster. My understanding is that the queueing discipline layer exists solely to lower latency and ...
Michael Martinez's user avatar
2 votes
0 answers
221 views

Qdisc class for eth0 disappearing

I have a script that sets up traffic shaping on port eth0. The script is as follows: import os import subprocess def run(cmd): print cmd result = subprocess.check_output(cmd, shell=True) ...
user3249763's user avatar
2 votes
0 answers
66 views

Measuring effectiveness of qdisc

I am trying to set the incoming and outgoing bandwidth of a particular interface. I set the outgoing bandwidth in the following way. sudo tc qdisc add dev f30e888e9a857_c handle 1: root htb default ...
user3249763's user avatar
2 votes
1 answer
1k views

bandwidth larger than tc htb ceil in 10-Gigabit network

In classid 88:201, I set ceil 200mibps, but in fact data can be send at 218 Mibps. Any one have any ideas what I'm doing wrong? Cheers! tc qdisc add dev eth0 root handle 88: htb default 202 tc ...
dd520's user avatar
  • 21
2 votes
1 answer
588 views

QoS Traffic Shaping based on packet loss and latency for VPN

I am currently having the following situation: I am using a VPN (OpenVPN) over a rather unstable internet connection. This means the maximum bandwidth varies between 100kbs and 1mbit. Whenever the ...
user2071301's user avatar
2 votes
0 answers
127 views

Traffic shaping linux shell users on a per-user basis

I have a debian 7 server with a number of shell users and I would like to limit upload and download rate on all interfaces (eth0, gre1, sit1) on a per user basis so each user has his own 75KB/s upload ...
Chris Kessler's user avatar
2 votes
0 answers
8k views

tc qdisc tbf - calculate sensible latency and burst from rate

I want to create a simple script that lets me limit the outgoing speed of an interface somewhere between 56k (modem speed) and 1MBit/s. I found that something along the following does the job: tc ...
josch's user avatar
  • 141
2 votes
0 answers
585 views

HTB equal bandwith sharing per ip in one class

In my tc configuration (shown below) in one class all bandwidth is shared among connections equally, but I want to share bandwidth among all IP addresses equally. Now: 192.168.0.2 - 38KB/s 192.168.0....
denizeren's user avatar
  • 329
2 votes
1 answer
2k views

Openvpn limit bandwidth

I would like to ask you a question concerning openvpn and the possibility to increase the bandwidth in case I want to transfer files. I have an openvpn server via which I connect to my data center. ...
user200913's user avatar
2 votes
0 answers
143 views

Is It Possible to Attach multiple Ports to a TC Filter?

I need to limit the bandwidth/rate by ports, and as a server there would be thousands of ports. Due to the limit of tc filter, I wonder if it is possible for multiple discreate ports to share a same ...
Steve Peng's user avatar
2 votes
0 answers
661 views

tc rules block traffic from some hosts at network

I have a problem I can not solve. The script, which sets the rules for traffic shaping is blocking the traffic from some hosts.If I remove all the rules, then it works. I can not understand why? ...
user avatar
1 vote
0 answers
337 views

How to limit Wireguard bandwidth

I have Debian 11 server with installed Wireguard with wg0 interface and 3 peers. Server bandwidth speed is 100 MBit and traffic is around 500 GB per month. What I need is: these 3 peers can use 100 GB/...
Space's user avatar
  • 11
1 vote
0 answers
174 views

tc prio qdisc example not working

I'm used tc to priority send packets to port 9999. tc qdisc add dev eno1 root handle 1: prio priomap 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 tc filter add dev eno1 protocol ip parent 1: prio 0 u32 match ip ...
hello's user avatar
  • 11
1 vote
0 answers
66 views

How to see contents of output queue of NIC in Linux and introspect frame delay

I am experimenting with tc tool to implement prioritization of specific data coming from my computer and would like to see exatly how the frames are scheduled and how much time they spend in the qdisc ...
Hadarelv's user avatar
1 vote
1 answer
6k views

WireGuard: Limiting download & upload bandwidth

I'm trying to limit download and upload speed of each wireguard peer to 512kbit. The problem is that my following commands, only limits download bandwidth of peer and doesn't limit upload bandwidth. ...
user3411911's user avatar
1 vote
0 answers
294 views

Dynamic bandwidth in Tc (Bandwidth Changes over time)

Basically I wanted to change the bandwidth after every 10 seconds using tc. So how to do that thing in tc. This is my script. !/bin/bash # # tc uses the following units when passed as a parameter. # ...
Abhishek Chapla's user avatar
1 vote
0 answers
211 views

Why the CLASSIFY action isn't applied by the iptables?

Why might the following simple iptables rule not work: iptables -t mangle -A POSTROUTING -p tcp --dport 1194 -j CLASSIFY --set-class 1:10 ? I'm trying to prioritize outgoing traffic to VPN. I am ...
Serge Roussak's user avatar
1 vote
0 answers
239 views

How can I limit incoming/outgoing connection speeds based off IPs?

I want to limit the speed each IP can download/upload files for every application on my server to 1Mb/s Example IP 192.168.0.1 is downloading at sustained 900Kb/s through FTP server if the IP then ...
Toodarday's user avatar
  • 215
1 vote
1 answer
127 views

Does tc guarantee network bandwidth for a process or run as best effort?

I have a tc rule as follows: qdisc tbf 1: dev bwp93ce2ea9d929 root refcnt 2 rate 100Mbit burst 100Kb lat 25.0ms Is this rule guarantee network bandwidth to be 100Mbps or it'll throttle if not enough ...
Michel Gokan Khan's user avatar
1 vote
0 answers
536 views

limit bandwidth per IP Linux ubuntu openVPN

I am a newmember in config ubuntu server and I installed an OpenVPN on a ubuntu 18.04 linux server, now I want to limit the server bandwidth with 2Mbit per IP for users that connect to the OpenVPN, ...
mohsen's user avatar
  • 113
1 vote
0 answers
185 views

Why does adding a single class to the htb qdisc in tc slow down my connection?

I'm running tc with the command: sudo tc qdisc add dev eth0 root handle 1: htb default 1. I then proceed to add a single class like so: sudo tc class add dev eth0 parent 1:0 classid 1:1 htb rate ...
Raiden Worley's user avatar
1 vote
1 answer
414 views

throttle outgoing linux network traffic under high latency

I want to slow my outgoing traffic when it encounters congestion, and measure "congestion" by packet response times. The intent is to avoid one NFS client starving all the other clients when ...
bukzor's user avatar
  • 263
1 vote
0 answers
564 views

tc rule not matching when applied on virtual interface created with Docker

I'm trying to delay traffic between containers (container1 calling container2) from a third container that has access to the host network and having capability NET_ADMIN (container3_admin). When I ...
Nicolas Henneaux's user avatar
1 vote
1 answer
285 views

tc command does not affect on two processes in a same machine

I am wondering why tc command does not work as expected. I set the command like the following tc qdisc add dev eno0 root handle 1:0 tbf rate 50mbit burst 25kb limit 250kb where I'm expecting ...
user9414424's user avatar
1 vote
1 answer
381 views

tc match IPv4 fragment offset

What is the correct Syntax for matching Fragments that have and Offset > 0 in tc? I have tried: ... u32 match u8 255 ff at 7 flowid 2:1 But to no avail
John's user avatar
  • 11
1 vote
1 answer
144 views

TC- HFSC : Can we have TC rule to set classes with minimum guarantee, but no maximum limit?

Can we set a rule where i can specify that my particular traffic will get minimum b/w no matter what, but no max limit if bandwidth is available. Eg : I have 20 mbps line. i want to set minimum 5 ...
kulhar's user avatar
  • 11
1 vote
0 answers
1k views

tc prio how the packets are prioritized

I want to use tc prio queuing discpline for scheduling packets in a particular order. I want to send out packets to destination port 5555 with the highest priority and packets to destination port 6666 ...
vijaya's user avatar
  • 11
1 vote
0 answers
203 views

force tbf qdisc to drop traffic

I have several virtual netspaces on my server connected via the virtual adapters. One of the connections between the netspaces is limited to 10 Mbps: root@core-wkst:/var/log# tc -s qdisc show dev ...
jpou's user avatar
  • 131
1 vote
1 answer
1k views

How to set an general network limit per client + priority for TCP acknowledgements

Following situation: Network A is connected to network B over an slow connection. Different hosts in network A would like to send traffic to hosts in network B. Hosts in network B sending commands to ...
Mr Mueseli's user avatar
1 vote
0 answers
714 views

Use tc qdisc netem to emulate delay, but ssh gets slow down

I have 3 VMs, A, B, and C. These VMs are all under the same network. On VM A, I use the following commands to introduce a delay to VM B. tc qdisc add dev eth0 root handle 1: prio tc filter add dev ...
Wei-Tsung's user avatar
1 vote
1 answer
2k views

rate limiting traffic for internal ip (TC)

I have configured ikev2 VPN on my server, but there is no tunnel interfaces like openvpn (tun0). So actually, I can't limit the ikev2 vpn speed using tc tool. Example for traffic shapping of openvpn (...
JohnsonGoey's user avatar
1 vote
0 answers
237 views

Create IFB with name or ID in Ubuntu server

I am doing some work relate to limit income bandwidth (ingress) of a NIC in Ubuntu 16.04. Seem like we cannot limit the income bandwidth directly but have to use IFB. In this this post we have a good ...
Andiana's user avatar
  • 121