Monday, March 19, 2018

Tweaking OpenVPN again

My latest tweaks for OpenVPN is very simple, just add these few lines to the server configure file:

txqueuelen 5000
tcp-nodelay

sndbuf 0
rcvbuf 0
push "sndbuf 174760"
push "rcvbuf 174760"


And add this line to /etc/rc.local on the server, somewhere before "exit 0":

ifconfig venet0 txqueuelen 10000

Replace venet0 with eth0 etc. if necessary, you can find it out with the ifconfig command. That's all.

The default txqueuelen values are way too small, 100 and 1000, for OpenVPN and Linux OS for today's network bandwidth. I saw lots of dropped packets (again, using the ifconfig command). My OpenVPN is used over LTE/4G mobile network, 5000 is enough. My Linux server is on a 10 Gigabit Ethernet, 10000 is about right. The network is significantly smoother than before. My OpenVPN uses TCP protocol, not UDP.

The "tcp-nodelay" option is good for reducing latency, a good thing for VoIP and gaming.

By setting the buffers to 0, OpenVPN will let the OS do the job. The default values are way too small. This is the major boost to speed, from 5Mbps to 20Mbps.

Why not push 0 to clients for sndbuf and rcvbuf? Because old versions of OpenVPN clients will really set these buffer sizes to 0, i.e., no buffer at all, resulting to crawling speed! So, unless all clients can be upgraded, don't do that. For LTE/4G, 174760 does well.

2 comments:


  1. Great post!!Thanks for sharing it with us....really needed.Find your Bank Important Things To Remember About Personalized Bank Checks With Pictures. When you decide to open a personal checking account, you will get the opportunity to pay using bank or personal checks.Reorder checks online

    ReplyDelete
  2. Get the Fastest VPN for 2018 that allows you to access blocked and restricted content from anywhere in the world. Stream and Download with complete anonymity and security. FastestVPN service provider offers secure access and high speed.

    ReplyDelete