Tuesday, January 9, 2018

How To Enable Jumbo Frames In Linux

https://linuxconfig.org/how-to-enable-jumbo-frames-in-linux

Objective

Configure Linux to use jumbo frames.

Distributions

This will work with any Linux distribution.

Requirements

A working Linux install with network connectivity and root privileges.

Difficulty

Easy

Conventions

  • # - requires given command to be executed with root privileges either directly as a root user or by use of sudo command
  • $ - given command to be executed as a regular non-privileged user

Introduction

Are file transfers slow on your network? Are you constantly passing data between your computers? Well, maybe jumbo frames are for you.

Jumbo frames are larger than standard network packet payloads. Normally the payload size or MTU(Maximum Transfer Unit) is set to 1500 bytes. Jumbo frames can support to 9000 bytes per packet.

Jumbo frames decrease the overhead associated with transferring files by limiting the number of packets that your networking equipment needs to process.

Set Up Your Network

For jumbo frames to work properly, every device on your network should be configured to use them. That said, if they don't it's not the end of the world. A device that doesn't support them will just break up the packets when they arrive. You should, at very least, configure your router and any switches on your network to use them.

MTU Settings on a DD-WRT Router

A lot of routers have settings that allow you to change the MTU size. It's in a different place on every router, but it usually appears in a general settings tab that controls the entire device or network.

When you find it, set it to a value that you think all of your devices can support. Remember, the upper limit for jumbo frames is 9000 bytes.

Check Your MTU size

Now that your network supports jumbo frames, check what your computer is set to. It's probably 1500 bytes, since that's the default, but it's good to make sure.

Everything here is going to be handled with the ip command. So, use it to check the MTU size allowed by your network interfaces.
$ ip link show | grep mtu
The numbers directly after the mtu is the value you're looking for.

Set A New Size

Setting the MTU size is really easy with ip. You just need to tell it which interface you want to modify and the size you want to set it to.
# ip link set eth0 mtu 9000
You can set every interface on your computer, if your hardware supports it.
# ip link set wlan0 mtu 9000

Make It Permanent

There are a couple of different ways you can make the new MTU size permanent. There is no specific utility for it, but the easiest thing you can do is create a script that runs at startup to set the MTU. If you're very comfortable working with systemd, you can change the network files it supplies to change the default MTU as well.

Your script should look something like this:
#! /bin/bash

ip link set eth0 mtu 9000;
ip link set wlan0 mtu 9000;
If you're on systemd, create a simple unit, and set it to run at startup.

OpenRC users can place their script in /etc/init.d/, and run it as a service at default.

Closing Thoughts

Jumbo frames reduce stress on your network, and can free up your router's computational resources. They're not going to make a huge difference in your network speed, but they may reduce the time required for file transfers.

No comments:

Post a Comment