Thread (4 messages) flat view 4 messages, 4 authors, 2021-06-17

Re: Simulating network throttling

From: Jeff King <hidden>
Date: 2021-06-17 07:19:25

On Wed, Jun 16, 2021 at 10:57:26PM +0000, brian m. carlson wrote:
On Linux, you can also use the tc command to do traffic shaping and
policing to allow only a certain amount of bandwidth, and you can use it
in conjunction with iptables or nftables to do it only on certain ports
or IPs.  It's very powerful and doesn't suffer from the limitations of
proxies, but it also is rather complicated to set up, so you may want to
try a proxy first to see if it meets your needs with less work.

OpenBSD's (and FreeBSD's, Darwin's, etc.) pf supports the same
functionality but with a much nicer and easier to use interface (and I
say this as a Linux user).
Yeah, these are both good suggestions that work transparently with any
protocol. I second the notion that tc is complicated to set up. ;)

If you really just want a pipe that will do rate-limiting in one
direction, many tools (e.g., "pv", which is available in debian) will do
it. That's hard to use with http, but you can stick it into an ssh
pipeline:

  $ git clone git@github.com:torvalds/linux.git
  Cloning into 'linux'...
  remote: Enumerating objects: 8129587, done.
  Receiving objects:   2% (163965/8129587), 70.89 MiB | 20.22 MiB/s
  ^C

  $ GIT_SSH_COMMAND='f() { ssh "$@" | pv -qL 512k; }; f' \
    git clone git@github.com:torvalds/linux.git
  Cloning into 'linux'...
  remote: Enumerating objects: 8129587, done.
  Receiving objects:   0% (15263/8129587), 7.57 MiB | 512.00 KiB/s
  ^C

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help