Skip to content

Instantly share code, notes, and snippets.

@bluzky
Created November 30, 2022 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bluzky/8a21df83bc4ac83a33664bfe0efe6204 to your computer and use it in GitHub Desktop.
Save bluzky/8a21df83bc4ac83a33664bfe0efe6204 to your computer and use it in GitHub Desktop.
Fix Ubuntu wifi slow

This may fix Ubuntu wifi slow.

Sometimes, after update OS, this setting is reset, so you have to modify it again.

Copy from this thread on AskUbuntu

Check your WiFi MTU, using

ip link

also notice your WiFi interface's name.

The MTU (Maximum Transmission Unit) is the size of the largest packet that can be sent in a single network transmission. If a packet exceeds the MTU of a link, the data must be split into multiple packets (fragmented). These multiple packets must be sent over the link, received, acknowledged, and reassembled at the far end. If your link is misconfigured, and you have to fragment every packet you send, your actual data transfer rate drops.

Ethernet (wired) networks use an MTU of 1500 bytes.

Due to additional per packet overhead for WiFi (8 bytes PPPoE header), WiFi uses an MTU of 1492.

Your MTU should be set by your DHCP server, check your router's config.

You can set your own MTU (setting does not persist over restarts) with

sudo ip link set dev name mtu 1492

where "name" is the interface name from above.

Here's an example:

walt@squid:~(0)$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp63s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000
    link/ether 00:24:21:7f:e5:1c brd ff:ff:ff:ff:ff:ff
3: wlxf46d04b1790f: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DORMANT group default qlen 1000
    link/ether f4:6d:04:b1:79:0f brd ff:ff:ff:ff:ff:ff
walt@squid:~(0)$   sudo ip link set dev wlxf46d04b1790f mtu 1492
[sudo] password for walt: 
walt@squid:~(0)$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp63s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000
    link/ether 00:24:21:7f:e5:1c brd ff:ff:ff:ff:ff:ff
3: wlxf46d04b1790f: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1492 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether f4:6d:04:b1:79:0f brd ff:ff:ff:ff:ff:ff

My WiFi "interface name" is "wlxf46d04b1790f".

NOTE: packet fragmentation is not logged, as it's a "feature" of the Data Link layer (layer 2 in the OSI model).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment