I went to this file /etc/dhcp/dhclient.conf and added these two lines before the request line:

default interface-mtu 1200;

supercede interface-mtu 1200;

After I restarted and the system boots up, I run ifconfig and it says my MTU size is 1280. Why?? How can I change it to exactly 1200??


cat /etc/resolv.conf:

lrwxrwxrwx 1 root root 29 Mar 19 13:05 /etc/resolv.conf -> ../run/resolvconf/resolv.conf

The resolv.conf file:

nameserver 2606:4700:4700::1111
options edns0

The resolvectl output is:

Current DNS Server:
     DNS Servers:
      DNSSEC NTA: 10.in-addr.arpa

The dpkg -l *dnsmasq* output is:

| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig- 
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                   Version          Architecture     
un  dnsmasq                <none>           <none>           (no 
description available)
ii  dnsmasq-base           2.79-1           amd64            Small 
caching DNS proxy and DHCP/TFTP server
un  dnsmasq-base-lua       <none>           <none>           (no 
description available)
  • Which file? How are you obtaining your IP address?
    – waltinator
    Mar 21, 2019 at 12:47
  • Please explain. I don't know of ANY situation where MTU of 1200 is valid. What version Ubuntu? Using NetworkManager or netplan? Report back to @heynnema
    – heynnema
    Mar 21, 2019 at 14:10
  • sorry , my bad , I forgot to tell which file I changed , I edit the post , and I get my IP from dhcp @waltinator
    – Afshin
    Mar 21, 2019 at 20:15
  • I am using ubuntu 18.10 and when I used VPN I couldn't browse some websites like twitter and facebook etc but I could ping them with Domain Name , and I searched a lot so I saw a topic that says change your MTU size to 1200 ,and after I've done that my problem solved , but when I edit /etc/dhcp/dhclient.conf for changing MTU permanently the system change MTU to 1280 @heynnema
    – Afshin
    Mar 21, 2019 at 20:21
  • Maybe check my question and answer here askubuntu.com/questions/1007171/no-internet-over-vpn-connection
    – oscar1919
    Mar 21, 2019 at 20:34

6 Answers 6


To determine the correct MTU setting, start with all MTU settings = 1500 and VPN = off. (VPN requires different testing).

Note: first remove your mods to /etc/dhcp/dhclient.conf and reboot.

In terminal:

ping [-c count] [-M do] [-s packet_size] [host]

The options used are:

  • c count: number of times to ping
  • M hint: Select Path MTU Discovery strategy. may be either do (prohibit fragmentation, even local one), want (do PMTU discovery, fragment locally when packet size is large), or dont (do not set DF flag).
  • s packet_size: Specifies the number of data bytes to be sent.

You should always start at 1472 and work your way down by 10 each time. Once you get a reply, go up by 1 until you get a fragmented packet. Take that value (last good value) and add 28 to the value to account for the various TCP/IP headers. Eg. let's say that 1452 was the proper packet size (where you first got an ICMP reply to your ping). The actual MTU size would be 1480, which is the optimum for the network we're working with.

ping -c 4 -M do -s 1472 # this will probably show fragmentation

ping -c 4 -M do -s 1462 # may show fragmentation

ping -c 4 -M do -s 1452 # no fragmentation?

ping -c 4 -M do -s 1453 # still no fragmentation?

reference: How to determine the proper MTU size with ICMP pings

Update #1:

I would recommend that you remove the 3 extra nameservers that you added to /etc/resolvconf/resolv.conf.d/head and let systemd-resolved properly manage /etc/resolv.conf. That should work better with VPN.

Update #2:

You can also setup a DIFFERENT wired/wireless connection profile, just for VPN, that hardwires the MTU=1200. In terminal, type nm-connection-editor and there you can customize a profile just for VPN with autoconnect and MTU.

enter image description here enter image description here

  • Comments are not for extended discussion; this conversation has been moved to chat.
    – terdon
    Mar 25, 2019 at 9:20

You can automate the setting of the mtu for the VPN port when the VPN goes up as suggested in script /etc/NetworkManager/dispatcher.d/01-ifupdown. Scripts in the dispatcher.d folder are called with the port and event as arguments.

So, create a script in folder dispatcher.d with the following contents (if you want mtu 1200):


#info : pre-up and pre-down are not implemented in network-manager

if [ "$2" = "vpn-up" ]; then  
    /sbin/ifconfig "$1" mtu 1200  

(The name of the script does not matter.) Then make it executable with chmod +x <script>.

  • I should just append these lines to 01-ifupdown ??
    – Afshin
    Mar 23, 2019 at 11:35
  • I think that is possible, but, as 01-ifupdown is an example script, I would not touch it and create a new one. Any name is ok, as long as it is executable and in the same folder. You will need sudo to put it in that folder.
    – oscar1919
    Mar 23, 2019 at 11:39
  • @Afshin you should first focus on determining what the correct MTU for your environment is, before trying to change it. Use the procedure in my answer first.
    – heynnema
    Mar 23, 2019 at 13:21

You could use tracepath ( from the iputils-tracepath package) to determine the Path MTU:

walt@bat:~(0)$ dpkg -S $(type -p tracepath)
iputils-tracepath: /usr/bin/tracepath
walt@bat:~(0)$ tracepath primus.ip4.torontointernetxchange.net
 1?: [LOCALHOST]                                         pmtu 1500
 1:  spark3y                                               0.525ms 
 1:  spark3y                                               0.497ms 
 2:  spark3y                                               0.465ms pmtu 1492
 2:  dsl-xxx-xxx-xxx-xxx.tor.primus.ca                    32.701ms 
 3:                                         34.726ms asymm  5 
 4:  bb1.tor.primus.ca                                    39.238ms 
 5:  primus.ip4.torontointernetxchange.net                33.295ms reached
     Resume: pmtu 1492 hops 5 back 4 
  • Good one. BTW, it looks like you've got DSL, and need to lower your Ubuntu MTU too :-)
    – heynnema
    Mar 24, 2019 at 23:20
  • Did you reset your MTU to 1492? You probably have fragmented pings right now.
    – heynnema
    Mar 25, 2019 at 13:38
  • @heynnema Right! I'd just replaced my hardware firewall distribution (IPCop to IPFire) and forgot this change to the DHCP server on the firewall.
    – waltinator
    Mar 26, 2019 at 5:23
  • It's not the DHCP server that you need to change... it's the MTU setting in your Wired Connection settings. For DSL, 1492 would probably be right, but you can use my procedure to confirm it.
    – heynnema
    Mar 26, 2019 at 13:08
  • Since I'm comfortable with hardware firewall management, and DHCP, the DHCP server on the firewall (where I assign IP addresses for my network) IS where I changed it. After a down/up, my MTU, assigned by DHCP to all 6 systems.
    – waltinator
    Mar 27, 2019 at 4:26

For those running Ubuntu under WSL, I found that MTU changes when joining a VPN were not propagating to the WSL vEthernet interface

# In windows command prompt
C:\Users\timothy.vanheest>netsh interface ipv4 show subinterface

   MTU  MediaSenseState   Bytes In  Bytes Out  Interface
------  ---------------  ---------  ---------  -------------
4294967295                1          0     111928  Loopback Pseudo-Interface 1
  1500                1  57917164385  17028233076  Wi-Fi
  1500                5          0          0  Ethernet
  1500                5          0          0  Local Area Connection* 1
  1500                5          0          0  Bluetooth Network Connection
  1500                5          0          0  Local Area Connection* 2
  1350                1  791851055   63176967  Ethernet 3
  1500                5          0          0  Ethernet 4
  1500                1    5268640   18986381  vEthernet (WSL)

Running this command (as admin) fixed it in a way that survived restarts.

# See: https://github.com/microsoft/WSL/issues/3957#issuecomment-479343268
C:\Users\timothy.vanheest> netsh interface ipv4 set subinterface "vEthernet (WSL)" mtu=1350 store=persistent

Not the best since it means I'm using a hardcoded MTU instead of the one that is optimal for the current network, but it's stable.

  • I tried this as a WSL2 fix as my VPN has an MTU of 1400 and although this did claim to change the MTU on the vEthernet adapter from 1500 to 1400, I found I still had problems with SSH crashing over WSL2. Strangely if I lowered it further the crashes became less frequent but still always happened. If I change the MTU inside WSL2 using ifconfig or ip commands to 1400 everything works fine - but doesn't persist over a reboot. Can anyone confirm similar behavior?
    – Phil
    Apr 16, 2021 at 9:11
  • 1
    Yes, I had the same issue. And since WSL doesn't have an init system you can't use something like systemd to fix it. My hack was to add a line to by my bashrc that sets the mtu on login if it's not already set. It does mean I'm prompted for my password the first time I login to a shell (so the sudo command works), but it's pretty painless. Apr 27, 2021 at 16:34

I described the solution here, this works on both command-line tools and graphical tools [both network and NetworkManager)

PPTP VPN randomly disconnects


I know this is an old topic, but for posterity in case anyone else comes across this question (since it's not answered anywhere else I can find).

Specifically addressing the question of setting the MTU in /etc/dhcp/dhclient.conf; not addressing whether this is ideal or how to check for a proper MTU value. Just the mechanics of setting the value.

OP spelled the 'supersede' statement wrong. The line below is the proper syntax, tested using isc-dhclient-4.4.1. Note: other services may apply their own changes to the MTU, but this will change the setting as far as dhclient is concerned.

supersede interface-mtu 1200;
  • This has been addressed by other answers. Mar 8 at 18:19
  • As stated in the beginning of my response, no it hasn't. The other answers gave alternate methods to achieve the same goal. My answer is intended to help anyone that may need to use the exact method the OP was attempting, and may not have the option of using the other existing answers. It is very common in any sort of systems work that the people implementing a solution do not get to control what sort of constraints we have to work with. If someone needs to use this exact method (specifying MTU in the dhclient config) for whatever reason, there is now a specific reference on how to do it.
    – NerdPirate
    Mar 9 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.