Internet speed extremely slow in terminal but fast on browser
I am facing extremely slow internet speed in the terminal while downloading packages. Currently my browser speed is 3mbps(measured using fast.com), and I also downloaded files that got downloaded on 400kB/s from browser, but from terminal when I am installing tensorflow
using pip3
the speed ranges from 20kB/s-30kB/s.
Here's what I have tried so far:
- Changed the mirrors from Software and Updates by selecting best server.
- Disable the IPv6 from Wi-Fi settings.
- Updated the system by
apt-get
. - Removed
#
fromprecedence::fff:0:0/96 100
located in/etc/gai.conf
Rebooted after every changes. Please help me in solving the issue! Thanks in advance
P.S: I am using Ubuntu 18.04
Solution 1:
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
".