While computer texts differ in their application of the term, Ubuntu uses the TCP Maximum Transmission Unit (MTU) to refer to the largest size a TCP packet a machine can pass over a TCP/IP networking connection. While calculating this value is relatively simple and defaults work on a majority of machines, it might be possible to further optimize your system if packets are fragmenting because of unusual settings. Sending large single outgoing packets is more efficient than sending multiple smaller outgoing ones.
The easiest way to find out the correct MTU value for your machine is to open up a terminal window. Hold down CTRL, ATL and T or perhaps start it from the Unity dash. If you’re working with Ubuntu Server, then you’ll default to a CLI interface with no graphical environment at all. Once you’re at the terminal, type in ping -s 1464 -c1 distrowatch.com and wait for the output. If you’re not receiving anything, then your networking connection hasn’t been configured correctly. Assuming you received proper output, then look for a section that reads 1464(1492) bytes of data, which indicates you’re sending the packet with 28 bytes of header information.
Method 1: Examining ping Output for Packet Fragmentation
The ping command will let you know if the packet was sent as more than one fragment with multiple header data attached. Examine the output for any line that warns about something regarding “Frag needed and DF set (mtu = 1492)” or any similar text. Depending on which version of ping was included with your version of Ubuntu, the warning may be worded differently. Should this text not be present, then more than likely you’re already working with some MTU measurement that isn’t sending out fragmented packets at the present time.
To find the most optimized MTU for your system, you would want to run this ping command with a small packet size, and then over time increase it until it begins fragmenting after which you consider this your cutoff point. Keep in mind that MTU = payload + 28, since there needs to be some room for the header data. Now, if you can increase the size to something very large without any fragments, then your network interface might be able to handle massive packets without the need for generating fragments. When you finally do see a Frag needed warning, this means that any packet sent with a payload the size you ran or higher will send as multiple packets. Assume that if you try ping -s 2464 -c1 distrowatch.com without any warning, but ping -s 2465 -c1 distrowatch.com sends a warning, this means that 2,464+28 is the largest MTU setting your TCP/IP configuration can handle before sending multiple fragmented packets. It might take a few moments to pinpoint an exact value.
Once you have a value in mind from running the ping command multiple times, you’ll need to run sudo ifconfig to find a list of known network interfaces. Ubuntu and its derivatives hash out the root account, but we operated from a shell created by sudo bash for our examples. It’s recommended you rather just preface each command with sudo individually.
As soon as you know the correct device, try:
sudo ifconfig interfaceName mtu ####
Replace interfaceName with the name of the network adapter you’re working with, and then replace #### with the size you found plus 28 for header information. You can run ifconfig to see what the default MTU was for your NIC and run it again multiple times to see if this previous command changes it. Some network interface adapters simply won’t let you change it. If that’s the case, then further optimization will be fruitless unfortunately. If, however, this worked, then you can actually make it permanent. Try running ifconfig | grep MTU to find all the values if you have multiple connectors, and then you can then match the values to the connectors you’re working with.
Method 2: Making MTU Optimizations Stick
So far you’ve made no permanent change to your system. If you reboot, then you’ll wipe any changes out, which is good if you’ve made some sort of mistake and find that you can’t connect to the Internet any longer. On the other hand, if you’ve found an accurate value for your MTU, then you’ll need to edit the document. This is probably a good time to make a copy of it in case something happens. Try or something similiar so you have a copy just in case. If you’d like to edit it graphically, then type and enter your password. If you’re using Kubuntu, Xubuntu or Lubuntu, then you’ll need to replace gedit with the graphical text editor your Ubuntu respin uses. Xubuntu, for instance, uses mousepad instead of gedit. If you’re using Ubuntu Server or simply prefer working with the command line, then instead type , assuming you’re not using a root shell.
Irrespective of which method you used to edit it, find the name of the interface ifconfig spit out before. Let’s assume you were looking at the first Wifi connector on your machine, which would probably be named wlan0 or something similar. In this case, find a snippet of code that starts with iface wlan0 inet static or something similar. Your mileage may vary, but the next line will read address followed by an IP address in ###.###.#.## format. It might be formatted differently if you’re on a native IPv6 connection. You’ll have a netmask and gateway line, followed by something that lists a host name or something similar. At the bottom, you’ll have another line that reads mtu and a number. Replace that number with the optimize MTU value, save the document and then exit the text editor. You’ll want to reboot the system to ensure it worked.
Should everything be fine after several reboots, then delete the interfaces.bak file in your ~/Documents directory. You could instead use sudo mv and then
if anything went awry in the process.
Method 3: Editing TCP Receive Window (RWIN) Settings
Ubuntu refers to the largest amount of data that a host accepts before it acknowledges the sender as the RWIN value. If you download a 30 MB file, then the remote server doesn’t actually immediately send you a 30 MB block of data. Your Ubuntu host sends a specific RWIN number when it requests the file, and then the server begins streaming data until it’s reached the number of bytes before it waits for an acknowledgement that your system got the data. Once the server receives this, it begins to send additional blocks before waiting for another acknowledgement.
Latency is the time it takes to transmit and receive packets from a remote server. Connection rates contribute to this value, but so do numerous other delays. The ping command will explain latency in terms of round-trip time (RTT) numbers. Look at the output from our previous ping of DistroWatch. You’ll find a line that reads time=134 ms, which is how long it took for packets to go round trip from our Ubuntu machine to distrowatch.com and back again. We were sending a 1,492-byte packet, so at 134 ms we could calculate a formula to find the total transfer speed:
1,492/.134 seconds = 11,134.328 bytes/second, which comes out to approximately 10.88 binary kilobytes per second. That’s rather slow overall, which is why RWIN is in place to keep you from having to acknowledge each packet sent individually.
RWIN settings in Ubuntu are separate from MTU settings. Calculate the Bandwidth Delay Product (BDP) for your Internet connection with this formula:
(Total maximum bandwidth your Internet connection should supply in Bytes per Second)(RTT in Seconds) = BDP
TCP packet size doesn’t influence RWIN, but the packet size itself is influenced by the value selected in Method 1. Use this command to find the kernel variables related to RWIN:
Please keep in mind there is a space after _mem, but nowhere else in the quoted text. You’ll get several values back. The ones needed are net.ipv4.tcp_rmem, net.ipv4.tcp_wmem and net.ipv4.tcp_mem. The numbers after these values represent the minimum, default and maximum values for each. They represent the receive window memory vector, send vector and TCP stack vector. If you’re running Ubuntu Kylin, then you might have a long list of additional ones. You can safely ignore any of these additional values. Some users of Kylin might also see some of the values delineated in other scripts, but once more simply look for these lines.
Ubuntu doesn’t have an RWIN variable, but net.ipv4.tcp_rmem is close. These variables control memory usage and not just the TCP size. They include memory eaten up by data socket structures and short packets in massive buffers. If you want to optimize these values, then send the maximum size packets you set in Method 1 to another remote server. Let’s use the 1,492-byte default again, subtracting 28 bytes for header information, but remember that you may have a different value. Use the command ping -s 1464 -c5 distrowatch.com to get additional RTT data.
You’ll want to run this test more than once at different times of the day and night. Try pinging some other remote servers as well to see how much RTT varies. Since we had an average of slightly over 130 ms each time we tried it, we can use the formula to figure out our BDP. Let’s assume you’re on a very generic 6 Mbits/second connection. The BDP would be:
(6,000,000 bits/sec)(.133 sec)*(1 byte/8 bits) = 99,750 bytes
This means the default net.ipv4.tcp_rmem value should be somewhere around 100,000. You could set it even higher if you fear that you’d get an RTT as bad as half a second. All values found in net.ipv4.tcp_rmem and net.ipv4.tcp_wmem need to be set identically, since transmission and reception of packets happen over the same Internet connection. You’ll generally want to set net.ipv4.tcp_mem to the same value used by net.ipv4.tcp_wmem and net.ipv4.tcp_rmem since this first variable is the total largest buffer memory size set for TCP transactions.
Issue the command and see if both of these settings are set to 0 or 1, which indicate a state of off or on.
Setting net.ipv4.tcp_no_metrics_save to 1 will force the Linux kernel to optimize the receive window between the net.ipv4.tcp_rmem and net.ipv4.tcp_wmem values in a dynamic fashion. When net.ipv4.tcp_moderate_rcvbuf is enabled, it prevents congestion from influencing subsequent connectivity. Before making any permanent changes, conduct a speed check through http://www.speedtest.net or http://www.bing.com/search?q=speed+test to make sure you have a handle on your measurements.
Temporarily change the variables with your calculated values. Make sure to replace the #s with your calculated sums.
sudo sysctl -w net.ipv4.tcp_rmem=”#### ##### ######” net.ipv4.tcp_wmem=”#### ##### ######” net.ipv4.tcp_mem=”#### ##### ######” net.ipv4.tcp_no_metrics_save=1 net.ipv4.tcp_moderate_rcvbuf=1
Retest your connect to see if the speed has improved, and if not tweak your command again and rerun it. Remember that you can push the up key in your terminal to repeat the last used command. Once you’ve found the appropriate values, open with the gksu or sudo text editor command from Method 1, and edit the lines to read as following, once more replacing the #s with your calculated values. You’ll of course want to also backup thefile the same way you did in part one just in case you make a mistake. If you’ve made one, then you can also restore in the same fashion as well.
net.ipv4.tcp_rmem=#### ##### ######
net.ipv4.tcp_wmem=#### ##### ######
net.ipv4.tcp_mem=#### ##### ######
net.ipv4.tcp_no_metrics_save=1
net.ipv4.tcp_moderate_rcvbuf=1
Save it once you’re sure everything is okay. Issue the following command:
sudo sysctl -p
This will force the Linux kernel to reload the settings in , and if all went well then it should give you at least a somewhat speedier network connection. Depending on your original defaults, the difference might actually be dramatic or potentially not noticeable at all.
Read Next
- Ubuntu 18.04 LTS Bionic Beaver Officially Available for Ubuntu, Kubuntu,…
- How to Speed Up and Optimize Windows for Improved Gaming Experience
- How to: Create an Ubuntu Bootable USB on Mac, Windows or Ubuntu
- Ubuntu 16.04.5 LTS Released on Heels of Ubuntu 18.04 LTS, Bundles All Past…
FAQs
How can I make my Ubuntu Internet faster? ›
- Solution 1: For Slow WiFi in Atheros Wireless Network Adapters. ...
- Solution 2: Disable 802.11n (works best if you have older router) ...
- Solution 3: Fix the bug in Debian Avahi-daemon. ...
- Solution 4: Disable IPv6 support.
The easiest way to find out the correct MTU value for your machine is to open up a terminal window. Hold down CTRL, ATL and T or perhaps start it from the Unity dash. If you're working with Ubuntu Server, then you'll default to a CLI interface with no graphical environment at all.
Does increasing MTU increase Internet speed? ›One of the easiest things you can do to increase your Internet speed is to adjust your router's MTU setting. MTU stands for Maximum Transmission Unit. It is essentially the setting that limits the maximum size of a packet that can be sent across a network.
How do I get the best MTU settings? ›Add 28 to that number (IP/ICMP headers) to get the optimal MTU setting. For example, if the largest packet size from ping tests is 1462, add 28 to 1462 to get a total of 1490 which is the optimal MTU setting. Change the MTU on the routers WAN Setup.
How do I get 100% Internet speed? ›- Turn things off and on again. ...
- Move your router to a better location. ...
- Switch your Wi-Fi frequency band. ...
- Adjust your router's antennas. ...
- Extend your Wi-Fi network. ...
- Prune unnecessary connections. ...
- Change your Wi-Fi frequency channel. ...
- Upgrade to faster internet.
- Get closer to your router or move the router closer to your computer. ...
- Close unnecessary background programs and applications. ...
- Clear your browser's cache and your browsing history. ...
- Update your computer, especially network drivers & router firmware.
MTU and packet fragmentation
The MTU of the next receiving device is determined before sending a packet to it. If the packet is too large and the next receiving device cannot accept it, the packet is divided into multiple packets and sent. This is called fragmentation.
The default standard value is 1500 bytes. However, you can increase the payload size of the packet, which allows you to send more data and increase the data transfer rates. You can increase the value by adjusting your MTU to 9000, which will enable the use of Jumbo Frames.
Should I set MTU to 9000? ›Generally, switches and routers should have an MTU of 9216 while nodes have the MTU set to 9000 bytes. When devices are configured incorrectly problems will usually be intermittent.
Why do you add 28 to MTU? ›You add 28 bytes because 20 bytes are reserved for the IP header and 8 bytes must be allocated for the ICMP Echo Request header.
What is the optimal MTU size for Ethernet? ›
For most Ethernet networks this is 1500 bytes, and this size is used almost universally on access networks. Ethernet II networks have a standard frame size of 1518 bytes, which includes a 14-byte Ethernet II header and a four-byte frame-check sequence (FCS). Other communications media have different MTU sizes.
Can MTU affect speed? ›The MTU size of the network can have a large impact on performance. The use of large MTU sizes allows the operating system to send fewer packets of a larger size to reach the same network throughput.
Should MTU be 1452 or 1492? ›It is generally recommended that the MTU for a WAN interface connected to a PPPoE DSL network be 1492. In fact, with auto MTU discovery, 1492 is discovered to be the maximum allowed MTU. However, having an MTU of 1452 is most optimal.
How do I fix MTU problems? ›- Make sure your routers do not drop ICMP "Destination Unreachable-Fragmentation Needed and DF Set" messages.
- If your router is set to 1500 bytes, try hardcoding it to a smaller size.
- Hardcode your clients with a smaller MTU size.
The reason for this is that by default, Juniper uses the standard IP MTU of 1500. Along with the default size, you have to account for 8 bytes being used for the ICMP header and another 20 bytes for the IP address. As such, 1472 bytes is the largest payload that you can set where you have "do fragment" turned off.
Why am I not getting my full Mbps? ›Your custom configuration is throttling your speeds
Some routers feature extra settings that allow you to restrict bandwidth to specific devices on your network. If your router uses any custom configuration, it might be affecting your connection speed.
- Check your router. Make sure you have a Gigabit WiFi router, which uses the protocol called 802.11ac (and can support speeds up to 1.3 Gbps).
- Consider Ethernet connections. ...
- Place your router strategically.
Some devices may not be able to measure the full speed of your internet service. It's also possible that your Wi-Fi router doesn't support the full speed of your service. Speedtest servers may perform differently. Generally, you will get faster speeds from servers closer to you.
How do I bypass a slow internet speed? ›What's the best way to bypass bandwidth throttling? If your ISP is throttling your bandwidth, and switching providers is not an option, the easiest solution is to connect through VPN. Your ISP won't be able to inspect the data packets, so it won't be able to throttle that traffic based on what service you're using.
How do I fix slow internet speed? ›“If you're getting slower Internet than you're supposed to, you can try resetting your modem and router (turning them off and on again). You might also want to check the other devices in your house before or after this step. If it's just one device that's slow, you might just have a hardware problem.”
Does increasing bandwidth increase internet speed? ›
The bottom line is bandwidth can affect speed, but speed can't go higher than bandwidth. You can get faster speeds through a fiber connection with a 5 Gbps bandwidth than on a cable connection with a 1 Gbps bandwidth. Faster speeds and higher bandwidths mean you can support more devices and do a lot more things online.
What is the disadvantage of MTU? ›The downside is that it can tie up a slow link while transmitting the larger packets and, if you have communication issues that require the packets to be re-transmitted, a larger MTU size would be costly since the entire larger packet has to be re-sent.
Is it safe to change MTU settings? ›Changing the maximum transfer unit (MTU) setting on your router may boost your overall network speed performance significantly. However, choosing the wrong setting could cripple your router and crush your overall network speeds to a level that is unbearable.
What is normal MTU size? ›The normal or default MTU size typically used is 1500 bytes and for a larger MTU size 9000 bytes tends to be the common choice. While 9000 bytes is typically used as a large MTU size, it also spans more than two physical 4K pages of memory.
Should you increase MTU size? ›Increasing the MTU can improve performance, and decreasing the MTU can resolve packet loss and fragmentation problems when it is too high.
How to change MTU size in Ubuntu? ›If your network interface is configured to obtain a static IP address, then you can change the MTU size by configuring the /etc/network/interfaces file. Make sure to replace <interface-name> with the actual interface name and <mtu_size> with the MTU size you want to set on the network interface.
Does changing MTU size require reboot? ›On smaller switches like 3800, 3700, 9300, changing the MTU requires a reboot as it applies to the whole switch. So, you need a reboot after deploying the config. Changing MTU should not affect the inband management connection but I recommend doing it during off-hours just in case.
What is the best MTU for 10gb? ›Setting the MTU
Though it is generally recommended that the 10GbE port's default MTU of 9000 be used, there is no significant difference in keeping this at the older value of 1500 provided EVO, the workstation, and any switch in-between are set accordingly.
1480 is just fine. If you are using wireless then try wired. Also the hubs have dodgy UPnP which either isn't fully compatible with Xbox one or just randomly stops working depending on the hub version. This causes NAT issues.
What happens if MTU does not match? ›If the MTU mismatch occurs, NDN packets would be dropped and the transmission would fail.
Is 1500 MTU good? ›
The MTU (Maximum Transmission Unit) states how big a single packet can be. Generally speaking, when you are talking to devices on your own LAN the MTU will be around 1500 bytes and the internet runs almost universally on 1500 as well.
How do I change my MTU speed? ›- Launch a web browser from a computer or mobile device that is connected to your router's network.
- Enter the router user name and password. The user name is admin. ...
- Select ADVANCED > Setup > WAN Setup.
- In the MTU Size field, enter a value from 64 to 1500.
- Click the Apply button.
What happens if MTU is too low? Your data is split into more packets, which means more bandwidth unnecessarily wasted on headers.
What is maximum allowable MTU? ›MTU is measured in bytes — a "byte" is equal to 8 bits of information, meaning 8 ones and zeroes. 1,500 bytes is the maximum MTU size.
What is MTU size for Gigabit Ethernet? ›Information About the MTU
You can change the MTU size to support switched jumbo frames on all Gigabit Ethernet and 10-Gigabit Ethernet interfaces and to support routed frames on all routed ports. The default maximum transmission unit (MTU) size for frames received and transmitted on all interfaces is 1500 bytes.
A larger MTU (Maximum Transmission Unit) brings greater efficiency in transmitting because each packet carries more data; however, a packet too large may be fragmented and results in lower transmitting speed instead. Optimizing the MTU value on the router's WAN interface can improve performance and avoid issues.
How do I change Ubuntu from 2.4 Ghz to 5Ghz? ›- click on 'Network Connections'
- 'Edit Connections...'
- [Select your network connection] (there could be 2 entries, any will do)
- Click Edit.
- Go to 'Wi-Fi' or 'Wireless' Tab.
- Click the BSSID Dropdown.
- Select the BSSID Matching the 5 Ghz Network (22:22:22:22:22:22 in this example)
- Switch to the 'General Tab'
Probably your Ubuntu system is running slow due to worn-out and outdated hardware. Therefore, updating your hardware and appliances could enhance the performance considerably. The first thing should be your Ubuntu system RAM. Notably, you need at least 2GB of RAM for your machine to run smoothly.
Can Ubuntu run on 1.5 Ghz processor? ›Minimum Requirements for Xubuntu 20.04 LTS:
a 1.5Ghz Dual Core processor. 2 GB of memory.
After opening your network adapter settings you need to select the “Advanced'' tab and then go to “Prefered band”. After clicking on it you should be able to see the value tab and from there you need to select “Prefer 5 GHz band” which should enable the 5 GHz connectivity on your laptop.
How can I separate the 2.4GHz and 5 GHz networks? ›
- Move away from the router. Move further away from the router when setting up the camera, but not so you are out of WiFi range. ...
- Change the settings on your router* ...
- Contact your Internet Service Provider (ISP)
If you want better range, use 2.4 GHz. If you need higher performance or speed, use the 5GHz band. The 5GHz band, which is the newer of the two, has the potential to cut through network clutter and interference to maximize network performance. Which means this band will be better for things like reducing game lag.
How much RAM should Ubuntu run smoothly? ›Minimum | Recommended | |
---|---|---|
RAM | 1 GB | 4 GB |
Storage | 8 GB | 16 GB |
Boot Media | Bootable DVD-ROM | Bootable DVD-ROM or USB Flash Drive |
Display | 1024 x 768 | 1440 x 900 or higher (with graphics acceleration) |
- Edit /etc/default/grub.
- Find line with: GRUB_CMDLINE_LINUX_DEFAULT.
- Append the following to args: intel_pstate=disable.
- Update grub: update-grub.
- Reboot.
Linux is open source, and the source code can be obtained by anyone. This makes it easy to spot the vulnerabilities. It is one of the best OS for hackers. Basic and networking hacking commands in Ubuntu are valuable to Linux hackers.
Which Ubuntu version is fastest? ›If you've upgraded to Ubuntu 22.04 then you probably noticed how smooth the GNOME experience is. If you haven't noticed then try comparing it to an older Ubuntu release or even the latest Fedora.
How much RAM does Ubuntu 20.04 require? ›The recommended system requirements are: CPU: 1 gigahertz or better. RAM: 1 gigabyte or more. Disk: a minimum of 2.5 gigabytes.
How many cores can Ubuntu use? ›Platform / model name | Hardware / CPU | Cores / memory / storage |
---|---|---|
Intel NUC ubuntu-core-20-amd64 ubuntu-core-18-amd64 | Intel Core i3, i5, i7 64-bit | >8 cores | >32 GB RAM no built-in storage |
Generic x86 / KVM ubuntu-core-20 ubuntu-core-18 | Full x86 32/64 bit CPU virtualisation | as defined |