2

My PPTP VPN works fine on Windows and Android. On Android and Windows, no specific configuration is needed only I need to check PPP encryption(MPPE).

But on Ubuntu 20.04 it disconnects randomly after a period of time.

2 Answers 2

2

I found the answer here: Ubuntu 14 pptp client disconnects frequently.

I had to use on the client.

sudo ifconfig wlp3s0 mtu 1400
sudo ifconfig ppp0 mtu 1300

This could be investigated by reading syslog errors:

pouria@pouria-pc:~$ cat /var/log/syslog | grep pptp | grep long
May 31 09:36:11 pouria-pc pptp[18156]: nm-pptp-service-18147 warn[decaps_gre:pptp_gre.c:352]: short read (-1): Message too long
May 31 09:47:14 pouria-pc pptp[18617]: nm-pptp-service-18609 warn[decaps_gre:pptp_gre.c:352]: short read (-1): Message too long
May 31 09:57:18 pouria-pc pptp[19439]: nm-pptp-service-19430 warn[decaps_gre:pptp_gre.c:352]: short read (-1): Message too long
May 31 10:07:21 pouria-pc pptp[20790]: nm-pptp-service-20781 warn[decaps_gre:pptp_gre.c:352]: short read (-1): Message too long
May 31 10:17:57 pouria-pc pptp[21003]: nm-pptp-service-20994 warn[decaps_gre:pptp_gre.c:352]: short read (-1): Message too long
May 31 11:16:36 pouria-pc pptp[23730]: nm-pptp-service-23718 warn[decaps_gre:pptp_gre.c:352]: short read (-1): Message too long

By setting mtu we are telling the wlan to use smaller messages.

I wonder why users of other operating systems don't have to configure their WLAN message size to use the simplest form of VPN.

update

To do it permanently

Find your device's interface name wlan0... by ifconfig.

Create the file /etc/network/if-up.d/ppp with the following content:

#! /bin/bash
sudo ifconfig wlp0s20f3 mtu 1400
sudo ifconfig ppp0 mtu 1300

Use chmod +x /etc/network/if-up.d/ppp to make it executable. It runs on every connect and disconnect.

1
  • Thank you, I searched a lot, and all of the answers on the internet wasn't solved, but this saved me!
    – SdSaati
    Aug 14, 2021 at 21:41
0

I use your answer, and answer it to solve the question about Set the MTU permanently:

I found this link (for permanent set the MTU)

We make a script in /etc/network/if-up.d/ and call it set-pptp.sh, this script will be called whenever a link is trying to get up.

Now inside this file we insert these lines:

[We are checking the current interface that is trying to get up, if it's a VPN, we set its MTU to 1300 and if not we set its MTU to 1400]

#!/bin/sh

if [ "$IFACE" = "ppp0" ]; then
   ifconfig ppp0 mtu 1300
fi

if [ "$IFACE" = "wlp3s0" ]; then
   ifconfig wlp3s0 mtu 1400
fi

Now we need to make it executable:

$ sudo chmod 755 /etc/network/if-up.d/set-pptp.sh

Last Step (Important):

If you are using a graphical network manager, those that are in KDE, Gnome, etc ..., you need to do this too:

Open this file: /etc/NetworkManager/dispatcher.d/01-ifupdown, in my computer, its name is 01-ifupdown, maybe in yours it has other names, open it.

Find the line that has something like this:

if [ "$2" = "vpn-up" ] || [ "$2" = "vpn-down" ]; then

Change it to this:

if [ "$2" = "vpn-up" ] || [ "$2" = "vpn-down" ]; then
    ifconfig ppp0 mtu 1300
   ADDRESS_FAMILIES=""
fi

Done, you have a permanently MTU settings now.

1
  • 1
    Thanks for the detailed response. I added my own shortcut version which is easier to do on each Ubuntu installation.
    – pjsofts
    Aug 15, 2021 at 3:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .