Skip to content

Instantly share code, notes, and snippets.

@larvata
Last active October 14, 2023 16:06
Show Gist options
  • Save larvata/02616b25c223668ccbd0 to your computer and use it in GitHub Desktop.
Save larvata/02616b25c223668ccbd0 to your computer and use it in GitHub Desktop.
shadowsocks bandwidth limit and data quota each port
# draft
# view current data quota
sudo iptables -nvL -t filter --line-numbers
# init
sudo iptables -I OUTPUT -p tcp --sport <target-port> -m quota --quota <quota-bytes> -j ACCEPT
sudo iptables -I OUTPUT -p tcp --sport <target-port> -j DROP
# reset quota
sudo iptables -R OUTPUT <line-number> -p tcp --sport <target-port> -m quota --quota <quota-bytes> -j ACCEPT
@noobjy
Copy link

noobjy commented Nov 16, 2016

-m quota ? quota is bandwidth?

@SnakeMa
Copy link

SnakeMa commented Mar 13, 2017

target-port 这里可以写端口号的范围么?比如 10000:20000
quota-bytes 这里的单位是什么?要限速每秒100KB的话,填写多少?

@mhbesharatnia
Copy link

mhbesharatnia commented May 7, 2018

i want set speed limit for each password or port in shadowsocks.json
how can do this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment