14 udp2raw UDPspeeder OpenVPN Guide
wangyu- edited this page 2018-08-24 20:55:14 +08:00

How it works

(If you cant see the image clearly, open it in a new tab)

Requirements

Server is assumed to be linux in this tutorial.

Client can be windows/mac/linux.

OpenVPN Setup

Install OpenVPN at server and client side,using the following conf file. Start openvpn at server side, do not run client at the moment

OpenVPN Conf File

Server Side
local 0.0.0.0
port 7777
proto udp
dev tun

ca /etc/openvpn/easy-rsa/2.0/keys/ca.crt
cert /etc/openvpn/easy-rsa/2.0/keys/server.crt
key /etc/openvpn/easy-rsa/2.0/keys/server.key
dh /etc/openvpn/easy-rsa/2.0/keys/dh1024.pem

server 10.111.2.0 255.255.255.0
ifconfig 10.111.2.1 10.111.2.6

client-to-client
duplicate-cn
keepalive 10 60

max-clients 50

persist-key
persist-tun

status /etc/openvpn/openvpn-status.log

verb 3
mute 20

comp-lzo no   #this option is deprecated since openvpn2.4. For 2.4 and above, use "compress" instead
#compress

fragment 1200       ##### very important    you can turn it up a bit. but, the lower the safer
mssfix 1200         ##### very important

sndbuf 2000000      ##### important
rcvbuf 2000000      ##### important
txqueuelen 4000     ##### suggested

replay-window 2000  ##### suggested
Client Side
client
dev tun100
proto udp

remote 127.0.0.1 3333
resolv-retry infinite 
nobind 
persist-key 
persist-tun  

ca ./ca.crt
cert ./client.crt
key ./client.key

keepalive 3 20
verb 3
mute 20

comp-lzo no   #this option is deprecated since openvpn2.4. For 2.4 and above, use "compress" instead
#compress

fragment 1200       ##### very important    you can turn it up a bit. but, the lower the safer
mssfix 1200         ##### very important

sndbuf 2000000      ##### important
rcvbuf 2000000      ##### important

replay-window 2000  ##### suggested

route 44.55.66.77 255.255.255.255 net_gateway
redirect-gateway def1
dhcp-option DNS 8.8.8.8
block-outside-dns          ### For non-Windows user delete this line
#route 0.0.0.0 128.0.0.0
#route 128.0.0.0 128.0.0.0

At server side, add the nat iptables rules, enable ip_forward

iptables -t nat -A POSTROUTING -s 10.111.0.0/16 ! -d 10.111.0.0/16 -j MASQUERADE
echo 1 >/proc/sys/net/ipv4/ip_forward

run udp2raw and udpspeeder

at server side

 ./speederv2 -s -l0.0.0.0:20000 -r127.0.0.1:7777 -f10:10 --mode 0
./udp2raw -s -l0.0.0.0:20001 -r 127.0.0.1:20000  --raw-mode faketcp  -a -k passwd

at client side

udp2raw_mp.exe -c -r44.55.66.77:20001 -l 127.0.0.1:8855 --raw-mode easyfaketcp -k passwd  #or use faketcp mode after added the firewall rules
speederv2.exe -c -l0.0.0.0:3333 -r127.0.0.1:8855 -f10:10 --mode 0 --report 10
note

For linux client, run udp2raw with:

./udp2raw -c -r44.55.66.77:20001 -l 127.0.0.1:8855 --raw-mode faketcp -k passwd -a  

(as -a works only on linux)

Finish

Run openvpn client with the prepared conf file. If no exception happens, openvpn will connect successfully. All traffic tcp/udp/icmp will be speeded-up by udp2raw and UDPspeeder.

(But by default, the traffic from local to VPS itself wont go through openvpn+udp2raw+UDPspeeder, otherwise there will be a traffic loop)