23 Jun Setting the right MTU for your OpenVPN server
A few months ago, I wrote about [setting up an OpenVPN server on Windows](https://www.michaelcheng.us/stuff/40). I was mainly using this to VNC to my workstation, and I noticed some pretty poor performance occasionally. It wasn't that the connection speed was slow -- it was actually dropping the connection almost every minute or so.
At first, I decided that it was the WiFi network I was on. Maybe there was congestion. Or maybe OpenVPN on Windows is just bad. After some research, I found that the problem may have been an incorrect MTU ([maximum transmission unit](https://wikipedia.org/wiki/Maximum_transmission_unit)). According to Sonassi's [knowledge base](https://www.sonassi.com/help/troubleshooting/setting-correct-mtu-for-openvpn), symptoms of incorrect MTU include:
* Slow VPN performance
* Incomplete page load of resources
I decided to give it a shot and identify the correct MTU for my server:
```
ping -n 1 -l 1500 -f www.example.com
```
According to the directions, decrease the `1500` value by `10` each time until the ping succeeds. For my workstation, `1470` was the right value.
![Finding the right MTU via ping](/_static/stuff/2019-06-23-mtu.png)
Next I had to update the MTU for the OpenVPN TAP network adapter.
![Open the adapter settings](/_static/stuff/2019-06-23-openvpn-tap.png)
In the MTU section, put the value for your workstation.
![Input the MTU value](/_static/stuff/2019-06-23-openvpn-mtu-config-windows.png)
Finally, update your `server.ovpn` config and use MTU-40 for your `mssfix`. For me, it's `1430`.
```
mssfix 1430
```
I found this was really useful for fixing the dropped connections. Hopefully it helps your Windows OpenVPN server as well.
Comments
Interesting!
Thanks! :)