Every time I connected to a Microsoft PPTP VPN server from Debian/Ubuntu desktop, I experienced slow network and dropped connections. Here’s how I fixed it.
After some digging around I found the default MTU of 1500 is too high. There’s nowhere to alter this in the GUI so each time after connecting I entered:
sudo ifconfig ppp0 mtu 1390
1390 works for me, as the Windows server is using 1400 for RRAS.
All good but not very efficient; so how to make this setting permanent? I tried appending /etc/ppp/ipup with
ifconfig $1 mtu 1390
but this didn’t work for me as the connection is managed by NetworkManager.
After reading through
man NetworkManager, I found there are a set of scripts that can be run to act on various events, so all that’s needed is a script to do the job:
sudo nano /etc/NetworkManager/dispatcher.d/vpn-up
#!/bin/sh #/etc/NetworkManager/dispatcher.d/vpn-up if [ "$2" = "vpn-up" ]; then /sbin/ifconfig "$1" mtu 1390 fi
Set mode on the script:
sudo chmod 0755 /etc/NetworkManager/dispatcher.d/vpn-up
After connecting to the VPN, check MTU is set correctly by issuing command and look for MTU of VPN interface (ppp0 in my case):
ppp0 Link encap:Point-to-Point Protocol inet addr:10.0.0.104 P-t-P:10.0.0.105 Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1390 Metric:1 RX packets:1302 errors:0 dropped:0 overruns:0 frame:0 TX packets:1728 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:3 RX bytes:442401 (442.4 KB) TX bytes:191311 (191.3 KB)
Works for me on Kubuntu 12.10 x64