Openvpn bandwidth limitation

Hi,

I am hosting some open vpn relays for my friends, so we can get around school blocks and download things quicker.

However, I want to make sure they don’t use up all the bandwidth of the server, since it’s also the home of my website.

Is there a way to do this?

I want to limit the download/upload speed, and the amount of data they can use each month.

Thanks all!
Edit: Thanks all for the advice. Will hopefully be able to get it working :slight_smile:

First off, dam bro I though I was the only one who self hosted while in school, this is awesome :smiley:

Second, I believe it depends on your setup, I don’t recall OpenVPN having the setting itself to be able to limit bandwidth, but I’m pretty sure certain router software (like PfSense, or DD-WRT) have an option to limit bandwidth, the only problem is you may have to make another network/VLAN just for the VPN

Again I’m don’t really recall if those options even exist anymore, I just saw your post is pretty fresh and wanted to throw some ideas your way :slight_smile:

Why not to use tc on the tun interface?

I self host while in school too! :o
For the bandwidth problem, you can use wondershaper probably: How to limit network bandwidth in Linux | Average Linux User

Use the OpenVPN interface maybe?

That’s awesome! If you don’t mind me asking, what kinda stuff do you host? Mine’s on a budget lol, I have a RPI 4 running Alpine, with docker containers for all sorts of things, vaultwarden, portainer, some ebook hosting (calibre), etc.

Wondershaper would probably work, OP will have create another interface on your computer and forward the VPN through there, then use wondershaper to cap it. If you use docker then it’s 1000 times easier too lol

OpenVPN seems to have a --sharper argument for throttling, but I’m not quite sure how it could be implemented for a server, I’ll do some more research and will edit this by tomorrow morning if I can o7

EDIT: my slow brain just came back to this comment and noticed you weren’t OP… oops, had to adjust the perspective of my comment lol

I run Proxmox 7 on my old desktop (i3-7100, 16gb ram) and host docker containers like vaultwarden, freshrss, Pi-hole, etc. Currently trying to find more stuff to selfhost

Dam bro, lucky I’ve always wanted to experiment with Proxmox but never had powerful enough software to run it lol. If you don’t kind me asking how does proxmox run on a dual core cpu? I always thought it was pretty hard on the i3 gens

I really suggest you look into portainer for docker containers, not even really for the management features but because of it’s feature called “App Templates”, the community can make docker-compose like files and upload them to portainer, it’s like 2 clicks to get a full service setup like Home Assistant!
(Also depending on what you already have at home I’ve had some fun hosting home assistant for controlling TVs and a telegram bot for notifications :slight_smile: )

It’s a quad core with hyper threading. I personally don’t use portaient because I put one container/app per lxc so it’s a bit annoying. Thanks though!