3

Every time I connect to my VPN, I should run

sudo ifconfig ppp0 mtu 1300

How could I make it permanent?

I am using Ubuntu 14.04.

peterh
  • 4,914
  • 13
  • 29
  • 44
Mohse Taheri
  • 141
  • 1
  • 5

4 Answers4

3

I've tried to apply Farshad's solution on ubuntu 16, and it wasn't working.

Only small fix was needed there - remove sudo inside your script, because everything inside /etc/network/if-up.d/ dir is already run as root user

#!/bin/sh

if [ "$IFACE" = "ppp0" ]; then
    ifconfig ppp0 mtu 1300
fi
juggernaut
  • 131
  • 3
2

You can define the mtu setting inside the /etc/ppp/options file. The setting should already be present in the options file but should be commented out by default.

ayaz
  • 483
  • 3
  • 10
  • It's not working, I diconnect and connect again but still shows 1400 mtu size – Mohse Taheri Aug 25 '15 at 06:26
  • @MohseTaheri: You will have to look into the PPTP config file (`/etc/pptpd.conf`) to see what file is defined for the `option` setting. By default, PPP looks in `/etc/ppp/options` but on Debian systems I have seen that the setting is overwritten to look into `/etc/ppp/pptpd-options`. You may have to make changes accordingly. – ayaz Aug 25 '15 at 07:08
  • it read `/etc/ppp/options` because when I set wrong mtu size it shows me an error but after setting correct value it doesn't change the mtu size after connection – Mohse Taheri Aug 25 '15 at 07:10
  • This worked on Ubuntu 22.04, been looking for this solution for a while – Phil Cook Sep 21 '22 at 10:16
2

As I said at this Link

You can make your custom script

at this address : /etc/network/if-up.d,

#!/bin/sh

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

finally make executable and enjoy from your life ...

Farshad
  • 121
  • 3
1

as farshad said in following link:

https://stackoverflow.com/questions/32196425/how-to-set-permanent-mtu-size-for-ppp0/32196605#32196605

the answer is add new file inside /etc/network/if-up.d/:

#!/bin/sh

if [ "$IFACE" = "ppp0" ]; then
    sudo ifconfig ppp0 mtu 1300
fi
Mohse Taheri
  • 141
  • 1
  • 5