0

I am having ubuntu 18.04 on a HP Omen laptop.

I have noticed that whenever I visit a website that I haven't visited before or I havent visited for the last hours it takes too many seconds to load(2-5sec). After the first time if i visit later it takes 'normal' time(0.1-0.5sec).

What I have tried/to be mentioned:

  • I have tested it on both Chrome and Firefox with the same issue on both.
  • wireless and wired test: same issue occurs.
  • I have disabled hardware accelerator from chrome and didn't helped.
  • another computer running on the same network with windows OS doesn't have this issue.

And some tests(taking advice from heynnema):

time host www.booking.com

When running the above for first time run (2.4sec)

real    0m2,410s
user    0m0,010s
 sys    0m0,000s

Running it again (0.01sec):

real    0m0,011s
user    0m0,000s
 sys    0m0,010s

Tested also on other websites where I saw some reaching even 6seconcs when running for first time.

Edit1

Also:

ls -al /etc/resolv.conf
lrwxrwxrwx 1 root root 39 Σεπ   3 21:00 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf

and:

cat /etc/resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to 
the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "systemd-resolve --status" to see details about the uplink DNS 
servers
# currently in use.
#
# Third party programs must not access this file directly, but only 
through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a 
different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported 
modes of
# operation for /etc/resolv.conf.

nameserver 127.0.0.53
options edns0

and:

ip addr | grep mtu
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
3: wlo1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
5: br-44cc05437844: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
6: br-a928e5f9d267: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default

and /etc/systemd/resolved.conf:

# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, 
try:
# `info libc "Name Service Switch"' for information about this file.

passwd:         compat systemd
group:          compat systemd
shadow:         compat
gshadow:        files

hosts:          files mdns4_minimal [NOTFOUND=return] dns myhostname
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis

and /etc/systemd/resolved.conf:

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See resolved.conf(5) for details

[Resolve]
#DNS=
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#Cache=yes
#DNSStubListener=yes

Edit2

Also using the answer from Use curl to find out which part of the process of loading a website is giving you trouble (used www.booking.com for the example below) I have the following result:

  DNS lookup                          :  6,516376
  Connect to server (TCP)             :  6,718620
  Connect to server (HTTP/S)          :  0,000000
  Time from start until transfer began:  6,718712
  Time for redirection (if any)       :  0,000000
  Total time before transfer started  :  6,950434

         Total time                   :  6,950476
         Size of download (bytes)     :  0
         Average d/l speed (bytes/s)  :  0,000

Seems like DNS lookup is taking the longest.

Any idea why is this happening? Thanks

Edit3

I have created a new resolv conf file resolv8.conf in /run/systemd/resolve with the following inside(google dns):

nameserver 8.8.8.8
nameserver 8.8.4.4

and a new symlink:

sudo ln -s /run/systemd/resolve/resolv8.conf /etc/resolv.conf

and now host -v .. and dns lookup timings are reasonable. However, there is 'collateral damage'. In every restart I loose the resolv8.conf file so I have to rewrite it and create new symlink again. Also with these changes chrome browsing works normally but not Firefox where I cant access any website(?? maybe i need to do something with networkManager?).

I tottaly dont get why is quicker now though.

Also is there a good way to make the changes permanent? Will this affect when I am connected to other rooters except of my house?

Edit4

Here a screenshot of my rooter configurations in case there are some wrong defined configs

enter image description here

Edit5

Testing on fresh 'try ubuntu 18.04' from usb:

Configurations seems the same with the above and also:

ip addr | grep mtu
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000  
2: eno1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000  
3: wlo1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000  

and

host -v www.airbnb.com | grep -i received
Received 190 bytes from 127.0.0.53#53 in 54 ms
Received 39 bytes from 127.0.0.53#53 in 432 ms
Received 39 bytes from 127.0.0.53#53 in 1847 ms
host -v www.booking.com | grep -i received
Received 69 bytes from 127.0.0.53#53 in 34 ms
Received 35 bytes from 127.0.0.53#53 in 823 ms
Received 35 bytes from 127.0.0.53#53 in 1039 ms  

Seems that there is the same issue. Slow dns lookup

1 Answers1

2

Your problem is with the MTU setting for your DSL connection.

There's a MTU setting in Ubuntu's network configuration, and a WAN MTU setting in your router.

For DSL, a common MTU setting is 1492. Just go ahead and try this value first and see if your web sites are now accessible.

To determine the correct setting, start with all MTU settings = 1500 and VPN = off. (VPN requires different testing).

In terminal:

    ping [-c count] [-M do] [-s packet_size] [host]

The options used are:

  • c count: number of times to ping
  • M hint: Select Path MTU Discovery strategy. may be either do (prohibit fragmentation, even local one), want (do PMTU discovery, fragment locally when packet size is large), or dont (do not set DF flag).
  • s packet_size: Specifies the number of data bytes to be sent.

You should always start at 1472 and work your way down by 10 each time. Once you get a reply, go up by 1 until you get a fragmented packet. Take that value (last good value) and add 28 to the value to account for the various TCP/IP headers. Eg. let's say that 1452 was the proper packet size (where you first got an ICMP reply to your ping). The actual MTU size would be 1480, which is the optimum for the network we're working with.

    ping -c 4 -M do -s 1472 8.8.8.8 # this will probably show fragmentation

    ping -c 4 -M do -s 1462 8.8.8.8 # may show fragmentation

    ping -c 4 -M do -s 1452 8.8.8.8 # no fragmentation?

    ping -c 4 -M do -s 1453 8.8.8.8 # still no fragmentation?

reference: [How to determine the proper MTU size with ICMP pings][1]

  [1]: http://muzso.hu/2009/05/17/how-to-determine-the-proper-mtu-size-with-icmp-pings

Update #1:

We need to check if your DNS servers have a problem with the options edns0 in /etc/resolv.conf.

/etc/resolv.conf is a symlink that goes to one of three places. Do a:

ls -al /etc/resolv.conf # note the original symlink setting

sudo cat /etc/resolv.conf # note the current file contents

sudo rm -i /etc/resolv.conf # remove the symlink


sudo ln -s /run/resolvconf/resolv.conf /etc/resolv.conf # new symlink

sudo cat /etc/resolv.conf # note the current file contents

retest DNS using:

host -v www.booking.com | grep -i received # use a different web site every time

sudo rm -i /etc/resolv.conf # remove the symlink


Depending on the results, you can also try this symlink:

sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf # a different symlink

sudo cat /etc/resolv.conf # note the current file contents

retest DNS using:

host -v www.booking.com | grep -i received # use a different web site every time

sudo rm -i /etc/resolv.conf # remove the symlink


If one symlink works better than the other, keep it for now. If none work better, set it back to original:

sudo ln -s /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf # reset to original symlink

heynnema
  • 73,649