Openvpn Bandwidth Limit

21,653

see the openvpn documents:

OpenvpnDoc

qoute:

--shaper n Limit bandwidth of outgoing tunnel data to n bytes per second on the TCP/UDP port. If you want to limit the bandwidth in both directions, use this option on both peers. OpenVPN uses the following algorithm to implement traffic shaping: Given a shaper rate of n bytes per second, after a datagram write of b bytes is queued on the TCP/UDP port, wait a minimum of (b / n) seconds before queuing the next write.

It should be noted that OpenVPN supports multiple tunnels between the same two peers, allowing you to construct full-speed and reduced bandwidth tunnels at the same time, routing low-priority data such as off-site backups over the reduced bandwidth tunnel, and other data over the full-speed tunnel.

Also note that for low bandwidth tunnels (under 1000 bytes per second), you should probably use lower MTU values as well (see above), otherwise the packet latency will grow so large as to trigger timeouts in the TLS layer and TCP connections running over the tunnel.

OpenVPN allows n to be between 100 bytes/sec and 100 Mbytes/sec.

You should add a client config file for this user.

However, this makes the whole situation pretty useless as the client can override the setting. If you only set it on the server its for all clients and only outgoing traffic from the server.

At best you should check out other ideas like doing this with iptables.

see the discussion on the OpenVPN users lists about this OpenVPN User List

Share:
21,653
Leonardo Gandini
Author by

Leonardo Gandini

Graphic and Web Designer | 3D operator, US-based but the soul is in Japan 日本. CSS3 and Html5! Thumbs up: Android, Juggling, and Starbucks. Google addicted!

Updated on September 18, 2022

Comments

  • Leonardo Gandini
    Leonardo Gandini over 1 year

    I have a vps server with Plesk Panel running on Centos 6.5.

    I'm using Openvpn AS and I'm wondering whether there's a way to limit the bandwidth per user (openvpn local user).

  • Leonardo Gandini
    Leonardo Gandini over 10 years
    +1 for iptables, I'll take a look at that, thanks!