Questions tagged [trafficshaping]

Traffic-Shaping refers to the modification of packet-based network protocols according to certain criteria. A frequent goal might be to forbid certain protocols e.g. for file sharing to limit data transfer rates. If intended to modify the network traffic, blocking certain ports also counts as traffic shaping.

Traffic Shaping refers to various methods to change the network load of a connection. The usual goal is to avoid clogging of a slow connection.

Example: Assume you have a DSL-connection with asymmetric up- and download speeds, i.e. slow upload and fast download. If you are sending an email while downloading a large file from a webserver, not all TCP packets necessary to continue the download will find their way to the webserver and thus the download is being delayed. A solution to avoid that is to throttle the email-upload thus that the requests for the download can find their way to the webserver.

Further reading: https://de.wikipedia.org/wiki/Traffic-Shaping

82 questions
3
votes
2 answers

How can I externally rate-limit a golang http upload?

I have a golang utility that uploads a lot of data via https to OpenStack Object Storage. I'm running it on Ubuntu Linux, and I would like to ensure that its maximum upload bandwidth does not exceed 2,500KB/s, preferably without affecting other…
3
votes
0 answers

Delaying incoming traffic using tc affects the host as well as VM

I wish to demonstrate a DNS cache poisoning attack. For this, I have configured a DNS server on a VM. I am trying to delay incoming traffic from the following IP addresses to the VM: 199.43.133.53 and 199.43.132.53 using tc and the following…
CuriousCat
  • 125
  • 1
  • 6
2
votes
2 answers

A C daemon that does traffic shaping

I'm working on a C daemon that monitors a configuration file (updated using a web interface) and then uses the Linux "tc" (traffic control) command to update the systems traffic shaping configuration. What's a good way to actually invoke the tc…
ChrisDiRulli
  • 1,482
  • 8
  • 19
  • 28
2
votes
0 answers

gsutil rsync is killing my cable modem; looking for command line throttling

I have written bash scripts to sync files to Google Nearline buckets; this is raw photos and music, so many GB of files. We run many devices, Netflix/Amazon streaming, gaming, phones, tablets, Skype, large and small downloads - all simultaneous…
2
votes
1 answer

How to filter packets marked by 'so_mark' using TC

I use so_mark to mark packets sent from a specific socket. Now I want to filter these packets from a class in my TC (from HTB mechanism actually). What is the filter to be used (and syntax example will be helpful as well)
SagiLow
  • 5,721
  • 9
  • 60
  • 115
2
votes
1 answer

cgroups and tc/netem: Not sure how to make them work together

I've having issues wrapping myself around cgroups and tc. I'm trying to add latency to a particular process. The code below is not working. But I have no clue what's wrong (or even what's right). # Set up net_cls to make modprobe cls_cgroup mount…
nishantjr
  • 1,788
  • 1
  • 15
  • 39
2
votes
3 answers

Slow down Ethernet connection

I have an Ethernet based device that I need to do some network connection testing on. Ideally I would like to both reduce the bandwidth (down to 10s of Kb/s) and if possible introduce lag (a second or so) into the network connection between the…
Donal M
  • 1,305
  • 2
  • 11
  • 23
1
vote
0 answers

Default traffic shaping rules for OpenVZ in CentOS 6

I have the following configuration: OpenVZ host running CentOS 6 (2.6.32-042stab049.6), gigabit connection A single container running on that OpenVZ The host has full gigabit connection for in- and outbound connections. The containers have full…
Mojah
  • 1,373
  • 2
  • 12
  • 16
1
vote
1 answer

Accessing same map from cgroup skb ebpf and tc egress ebpf hook

I am trying to access fmap which is already present in cgroup skb bpf object file, from tc egress ebpf hook. By default, the map is getting created in /sys/fs/bpf/tc/globals/fmap. But i want to access the /sys/fs/bpf/fmap in tc egress cgroup. How to…
1
vote
0 answers

Router NAT block uploads from subnet

I have this scenario. I need to block large uploads from the private network (10.0.30.0) to the internet. I am routing 0.0.0.0/0 traffic from the private network via the Bastion / Router eth1. There I am forwarding: sudo sysctl -w…
1
vote
2 answers

Spreading out data from bursts

I am trying to spread out data that is received in bursts. This means I have data that is received by some other application in large bursts. For each data entry I need to do some additional requests on some server, at which I should limit the…
LiKao
  • 10,408
  • 6
  • 53
  • 91
1
vote
1 answer

Ingress/egress confusion in tc

Can someone explain me please, because I don't understand the following concept. In tc you can add a dummy qdisc which can process a fraction of traffic by some specific rules. For exapmle, here you create an explicit ingress qdisc for eth0. No idea…
krop
  • 75
  • 9
1
vote
1 answer

Under what circumstances does bpf_get_socket_cookie() return 0

bpf-helpers(7) states that bpf_get_socket_cookie() returns 0 if the socket field is missing inside skb. Under what conditions is the socket field missing in this context? Does it depend where in the datapath a BPF program is attached to? For…
rookie099
  • 2,201
  • 2
  • 26
  • 52
1
vote
1 answer

What is the exact relationship between BPF filters in a single chain

I have an network interface $dev which already had a BPF filter attached to a special qdisc ingress (with pref 1 and direct-action). I have added another one (with pref 2). tc filter show dev $dev ingress reports the following: filter protocol all…
rookie099
  • 2,201
  • 2
  • 26
  • 52
1
vote
0 answers

Network Output Buffering

How can I hold the packets generated from a server until an external signal is delievered. On receiving the signal the host hosting the server should release the packets? I think it can be done with qdisc module in kernel but i don't know how to use…