ArchLinux4.0: Setting MTU with netctl

First things first: Ive been encountering some serious internet problems,with either my gateway or the way the network was set.
I always felt a huge drop in throughput.
After some searching I found out, that netctl can handle custom mtu configurations as well. The ‘ExecUpPost’ entry in a connection profile handles this. Here’s the simple ethernet-static profile that I’m using for my work network :

nerd@trojan:/$ sudo nano /etc/netctl/my_lan

Description=’Science Block private ethernet connection’
ExecUpPost=’/usr/sbin/ip link set enp5s0 mtu 258′

#And then restart for settings to take effect
nerd@trojan:/$ sudo netctl my_lan restart

PS: before setting the MTU size, initially test and determine the optimum size

optimal MTU value has nothing to do with modem or connected computer. It depends on your ISP

You can check optimal MTU value pretty easy by pinging any website with different MTU value starting from lower going up to first ping error:
start with lets say value 1460 and go up:

In my case 230 has got no error:

nerd@trojan:/$ ping -c 5 -M do -s 230
PING ( 230(258) bytes of data.
238 bytes from ( icmp_seq=1 ttl=44 time=1681 ms
238 bytes from ( icmp_seq=2 ttl=44 time=1961 ms
238 bytes from ( icmp_seq=3 ttl=44 time=2235 ms
238 bytes from ( icmp_seq=4 ttl=44 time=1879 ms
238 bytes from ( icmp_seq=5 ttl=44 time=1793 ms

— ping statistics —
5 packets transmitted, 5 received, 0% packet loss, time 7537ms
rtt min/avg/max/mdev = 1681.069/1910.091/2235.116/187.261 ms, pipe 3

and remember: pack_size +byte_size = mtu or something along those lines
in my case: 230+28=258(mtu)

I’m sharing it here, in case
a) anyone else encounters the same problem and
b) I forget again, how to set it


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s