From 0e7866cb719fb973b40c3ea53c3f7fb04a1728d6 Mon Sep 17 00:00:00 2001 From: hybtoy Date: Wed, 9 May 2018 09:33:12 +0500 Subject: [PATCH 1/2] TCP_NODELAY Add tcp_nodelay option for proto tcp --tcp-nodelay This macro sets the TCP_NODELAY socket flag on the server as well as pushes it to connecting clients. The TCP_NODELAY flag disables the Nagle algorithm on TCP sockets causing packets to be transmitted immediately with low latency, rather than waiting a short period of time in order to aggregate several packets into a larger containing packet. In VPN applications over TCP, TCP_NODELAY is generally a good latency optimization. --- openvpn-install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openvpn-install.sh b/openvpn-install.sh index 49adb4a..3983cc4 100644 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -689,6 +689,8 @@ WantedBy=multi-user.target" > /etc/systemd/system/iptables.service echo "proto udp" >> /etc/openvpn/server.conf elif [[ "$PROTOCOL" = '2' ]]; then echo "proto tcp" >> /etc/openvpn/server.conf + echo "socket-flags TCP_NODELAY" >> /etc/openvpn/server.conf + echo "push "socket-flags TCP_NODELAY"" >> /etc/openvpn/server.conf fi echo "dev tun user nobody From 8a1c3517a53e71719c470d3f6d8fde203f15185b Mon Sep 17 00:00:00 2001 From: hybtoy Date: Wed, 9 May 2018 10:19:49 +0500 Subject: [PATCH 2/2] Update openvpn-install.sh --- openvpn-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index 3983cc4..cc4715f 100644 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -690,7 +690,6 @@ WantedBy=multi-user.target" > /etc/systemd/system/iptables.service elif [[ "$PROTOCOL" = '2' ]]; then echo "proto tcp" >> /etc/openvpn/server.conf echo "socket-flags TCP_NODELAY" >> /etc/openvpn/server.conf - echo "push "socket-flags TCP_NODELAY"" >> /etc/openvpn/server.conf fi echo "dev tun user nobody @@ -884,6 +883,7 @@ verb 3" >> /etc/openvpn/server.conf echo "proto udp" >> /etc/openvpn/client-template.txt elif [[ "$PROTOCOL" = '2' ]]; then echo "proto tcp-client" >> /etc/openvpn/client-template.txt + echo "socket-flags TCP_NODELAY" >> /etc/openvpn/client-template.txt fi echo "remote $IP $PORT dev tun