Template:MTU

From The Brainwrecked Wiki
Jump to navigation Jump to search

Template:Information/Template

If you are using Gigabit Ethernet, you can change the MTU setting for better performance. Gigabit Ethernet accepts MTUs up to 9000, but a lot of Gigabit Ethernet chipsets do not go this high. This number cannot be any higher than any server you plan to communicate with.

Use the following command to determine which Ethernet device you are using. The one with an IP address is the one you are interested in.

ip addr

You'll get output like this:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether hh:hh:hh:hh:hh:hh brd ff:ff:ff:ff:ff:ff
    inet nnn.nnn.nnn.nnn/24 brd 192.168.1.255 scope global eth0
    inet6 hhhh::hhhh:hhhh:hhhh:hhhh/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether hh:hh:hh:hh:hh:hh brd ff:ff:ff:ff:ff:ff

Use the following command to determine the the max MTU setting.

sudo ip link set [device] mtu [1500-9000]

You'll basically be playing a game of guess-the-number. No feedback means the command was successful. You'll know you've gone too far when you see [DRIVER] answers: Invalid argument.

Once you've determined the largest valid number you can use, you need to to make sure that your network hub or router isn't a limiting factor and that the drivers aren't allowing you to set the MTU higher than the actual hardware can handle.

ping -s [size-minus-8] [ip-address]

If you do not receive a response with the MTU setting you got earlier (less 8 bytes for the ICMP header) then something is goofed and you will have to play the number guessing game again until you can make a successful ping.

Once you find your optimal MTU setting, it's time to get the setting to stick on every boot.