#Limit Network

48 messages · Page 1 of 1 (latest)

plush wagon
#

Is there a way to limit network in/out for each current and new container/server that would be made on the nodes automatically?

devout vortex
#

That would be very nice actually

white crystal
#

Not directly through pterodactyl. I didn’t do this before so I’m not an expert but it should be possible directly through docker

plush wagon
devout vortex
#

That reminds me of this one meme (or maybe happened) where there where two people who owned a rack in a datacenter

#

and one of them was appearntly DDoSing the other

plush wagon
#

😭

devout vortex
#

so they told the datacenter to shutdown the rack

#

and they did

plush wagon
#

Thats crazy

devout vortex
#

I've seen it done before

white crystal
devout vortex
#

If you want a limit on the docker network (basically all servers and the wing together) Traffic Control is an option

white crystal
#

One of my customers was attacked using ddos. Hetzner was like: hmm let’s shutdown his complete network traffic

But we were attacked and not attacking 😭

devout vortex
#

I think it's possible

#

after talking with chat GPT

#

It says something like

#!/bin/bash
for container in $(docker ps -q); do
    veth=$(docker inspect --format='{{.NetworkSettings.SandboxKey}}' $container | xargs basename)
    tc qdisc add dev $veth root tbf rate 1mbit burst 32kbit latency 400ms
done
plush wagon
devout vortex
#

uhh

#

actually ehh

plush wagon
#

whhich can be done through CRON

devout vortex
#

yeah

devout vortex
#

Docker can limit bandwidth per network

plush wagon
#

Hmm

#

That could work until we get 50+ accounts/servers then itll need to be throttled, right?

devout vortex
#

but if you wanted you could do a global limit on top of that

#

although doesn't really make any real world sense

#

I love talking about anything linux related lmao

plush wagon
# devout vortex I'd do this

Yeah, gonna set up a a script to have this run every 5 seconds (is that bad if i run it every 5 seconds?) have a systemctl to make sure it stays on 24/7 and applies these

devout vortex
#

5 seconds is fine

#

use cron or something

#

maybe 5 seconds is very extra

#

30 seconds would be plenty

#

it's fine if they make a server and aren't limited for the first little while

#

Idk if cron can do 30 seconds

#

Just do one minute

#

just make a bash script for example

limitBandwidth.sh

#!/bin/bash
for container in $(docker ps -q); do
    veth=$(docker inspect --format='{{.NetworkSettings.SandboxKey}}' $container | xargs basename)
    tc qdisc add dev $veth root tbf rate 1mbit burst 32kbit latency 400ms
done
#

crontab -e

#

* * * * * /home/<user>/limitBandwidth.sh

#

or where ever you put it

plush wagon