Saturday, 11 February 2012

Slow Web Browsing in Ubuntu

A couple of years ago I bought a Belkin wireless router. No big surprises there. My main PC connected to it via a network cable, my kid's PC using wireless.

In Windows it works great. In Linux it didn't. There was a noticable delay (around four seconds) from entering a web address to the page starting to load. Every time.

In the end I switched to a different router which nicely avoided the problem, and the old router took up it's new position as an "emergency backup."

Now the new router has finally failed, and so I've switched back to the "old" one, and yes, it is still slow to browse in Ubuntu. The funny thing is that once the page starts loading it loads quickly, but there is that long delay before it starts.

So now I'm stuck with it, and with the benefit of a couple of years more experience under my belt it is time to find out what's going wrong.

Let's turn to our good friend dig and see whats going on:

dig www.google.com

This gives the following response:

;; reply from unexpected source: 8.8.8.8#53, expected 192.168.1.1#53

; <<>> DiG 9.7.3 <<>> www.google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 59114
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.google.com. IN A

;; ANSWER SECTION:
www.google.com. 3 IN CNAME www.l.google.com.
www.l.google.com. 3 IN A 209.85.229.99
www.l.google.com. 3 IN A 209.85.229.103
www.l.google.com. 3 IN A 209.85.229.104
www.l.google.com. 3 IN A 209.85.229.147
www.l.google.com. 3 IN A 209.85.229.105

;; Query time: 36 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Sat Feb 11 17:45:21 2012
;; MSG SIZE rcvd: 132

The first line gives a very good clue as to what the problem may be.

reply from unexpected source: 8.8.8.8#53, expected 192.168.1.1#53

The unexpected source is what I would have thought was my primary DNS server (and indeed the router's configuration confirms this, with 8.8.4.4. as the secondary). The "expected" IP address is the router itself. This explains the slow browsing - as there there will be a delay while the DNS request is made to the router (which doesn't respond) before moving on to the true DNS server (which does).

Running the connection information tool confirms this. The router is being set up as the primary DNS server, with 8.8.8.8 as the secondary and 8.8.4.4 as tertiary.

The fix? I've set up a manual IP address for the desktop, which is just out of the router's DHCP scope, and manually specifies the correct DNS entries (but remembering to set the router as the gateway). Browsing is now just as fast on Ubuntu as it is on Windows.

Sorted!

1 comment:

johnny portman said...

Hey buddy that was a gud post
I have gone through your site information and it is the same opportunity that I was looking for. The facilities, the process that what you are offering are perfectly matched to my Expectation & very soon you will get Response from my side. cat mario