# Openvpn on VPS, Bandwidth limit?



## bardaxx (Apr 22, 2015)

Hello everybody, i have installed openvpn on my vps!

All works, but i have the "download limit" set to 10Mb/s.
 

how to allow to use the max bandwidth of my VPS through vpn?

Thankyou  

ps. Great forum! i love it!


----------



## Francisco (Apr 22, 2015)

You can use the linux program 'trickle' 

http://manurevah.com/blah/en/p/trickle-bandwith-shaper

The biggest issue is it doesn't support UDP, though, so if you're using OVPN over UDP you'll need to look into possibly iptables or using linux 'TC'.

Francisco


----------



## bardaxx (Apr 22, 2015)

Francisco said:


> You can use the linux program 'trickle'
> 
> http://manurevah.com/blah/en/p/trickle-bandwith-shaper
> 
> ...


 thank you for reply, yes i use "proto udp" on server.conf, what is the difference if i set to "tcp" ? thankyou!


----------



## GIANT_CRAB (Apr 22, 2015)

bardaxx said:


> thank you for reply, yes i use "proto udp" on server.conf, what is the difference if i set to "tcp" ? thankyou!


Hello, do take a look at this - https://en.wikipedia.org/wiki/Transport_layer#Comparison_of_transport_layer_protocols


----------



## Francisco (Apr 22, 2015)

bardaxx said:


> thank you for reply, yes i use "proto udp" on server.conf, what is the difference if i set to "tcp" ? thankyou!


UDP can be a bit faster for OpenVPN, but it also depends on if you're using OpenVPN to get around firewalls/etc. Both work just fine, it's just that trickle works with TCP only if you want to go that route.

As I said, tc is another option but it's a lot more complex. You'd need to do something like...



/sbin/tc qdisc del dev MAIN_INTERFACE root

/sbin/tc qdisc add dev MAIN_INTERFACE root handle 1: htb
/sbin/tc class add dev MAIN_INTERFACE parent 1: classid 1:1 htb rate 10mbit
/sbin/tc class add dev MAIN_INTERFACE parent 1:1 classid 1:5 htb rate 10mbit ceil 10mbit prio 0
/sbin/tc filter add dev MAIN_INTERFACE parent 1:0 prio 1 protocol ip handle 5 fw flowid 1:5

/sbin/iptables -A OUTPUT -t mangle -p udp -s VPN_SUBNET_HERE -j MARK --set-mark 5
This won't hard cap it at 10mbit due to how it samples, but it should keep it right around that limit for the most part.
tc is still hit/miss when it comes to OpenVZ support since it usually requires extra permissions that not all hosts have given/will give. You might be able to use iptables to handle all the rate limiting but I can't see the performance being very good with that.

Francisco


----------



## clarity (Apr 22, 2015)

I read the first post as he wanted to unlimit the speed that he is seeing.

@bardaxx What is the speed of the connection that you are using to connect to the server?


----------



## bardaxx (Apr 23, 2015)

clarity said:


> I read the first post as he wanted to unlimit the speed that he is seeing.
> 
> @bardaxx What is the speed of the connection that you are using to connect to the server?



Thank you for the replies guys, so


my Vps have 100Mbit/s, at home I have 20Mbit/s but i reach only 10Mbit/s.



Francisco said:


> UDP can be a bit faster for OpenVPN, but it also depends on if you're using OpenVPN to get around firewalls/etc. Both work just fine, it's just that trickle works with TCP only if you want to go that route.
> 
> 
> As I said, tc is another option but it's a lot more complex. You'd need to do something like...
> ...


Francisco i need to add this rules?


MAIN INTERFACE = tun0 


VPNSUBMASK = 255.255.255.0 


right?


Thank you guys!


----------

