Score:2

How can I limit the outbound traffic?

mx flag

I have a server running Ubuntu 22.04. They give me a monthly allowance of outbound traffic (bandwidth). When my server runs above this allowance, they do not stop the server - they let it run, and charge me 1 cent per GB, which can reach hundreds of dollars per day.

Is there a way I can put a hard limit on the outbound traffic, so that when the limit is hit, the server simply blocks all outbound traffic from now on?

Score:1
in flag

Most network limiters I know offer bandwidth restriction per second, but your granularity is per month. I would write a script to harvest the outgoing amount from /proc/net/netstat and if it's above a threshold run an iptables rule to block all outgoing traffic except for the SSH traffic to/from my machines and run it in a cron job or system timer

mx flag
Bandwidth restriction per second could also be useful in my case. How exactly can I do this?
sleepyhead avatar
in flag
tc and iptables have ratelimiting options, wondershaper and trickle are applications I've never used. With tc you can shape your traffic classes and add them to different queues to set priorities. It's complicated and powerful. If I have time I'll update my answer to give some examples.
Nick Sillito avatar
de flag
Have a look at [wondershaper](https://averagelinuxuser.com/limit-bandwidth-linux/#:~:text=user%2Dfriendly%20applications.-,Limiting%20the%20bandwidth%20per%20network%20interface%20with%20Wondershaper,interface%20of%20your%20Linux%20machine)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.