PCLinuxOS-Forums
News: ...FLASH!!! ...New PCLinuxOS Testing board now open. Register today! Be an active contributor to the PCLinuxOS future! ... Read all about it now, on THIS forum!!!..
 
*
Welcome, Guest. Please login or register. May 27, 2012, 08:07:13 PM


Login with username, password and session length


Pages: [1]   Go Down
  Print  
Author Topic: HOWTO: DNS caching  (Read 717 times)
janasx1
Full Member
***
Offline Offline

Posts: 111



« on: November 15, 2011, 11:56:32 PM »

Hi,
This posting is to let others know how I configured DNS caching and improved browsing performance.

1. installed package bind-utils for dig/nslookup
2. installed package bind
3. In PCLinuxOS Control Center > System > "Manage system services..."
4. clicked Start button for named service
5. changed network config to use 127.0.0.1 as the first DNS server and the second DNS to one of the openDNS. I do have both openDNS servers (208.67.222.222 208.67.220.220) configured in my wireless router.

tried "dig www.google.com" twice and can see significant difference in the time to resolve to ip.

I think when a dns request is sent, named tries to get from its cache and if not found, it tries with the dns from the default gateway (router in my case) and then caches it for subsequent requests.

Hope this helps.
Thanks
Logged

HP Pavilion notebook DV6400, AMD Turion TL-64, 2GB RAM, broadcom BCM4312, nvidia Geforce Go 6150
gseaman
PCLinuxOS Tester
Hero Member
*******
Offline Offline

Posts: 2808



« Reply #1 on: November 16, 2011, 12:35:52 AM »

In PCC, bind does not like localhost as the domain. It says that you need a FQDN, fully qualified domain name. When I change the hostname it still says that localhost is not a FDQN. Any tips on this part?

Galen
Logged
janasx1
Full Member
***
Offline Offline

Posts: 111



« Reply #2 on: November 20, 2011, 08:14:50 PM »

Hi Galen,
In my hosts file, I have 2 entries for 127.0.0.1

127.0.0.1  compname.somedomain
127.0.0.1 localhost

In /etc/sysconfig/network, I set the HOSTNAME=compname.somedomain

Please try and let me know if it works.
Thanks
Logged

HP Pavilion notebook DV6400, AMD Turion TL-64, 2GB RAM, broadcom BCM4312, nvidia Geforce Go 6150
AndrzejL
PCLinuxOS Tester
Super Villain
*******
Offline Offline

Posts: 11990


Registered Linux User #490933


WWW
« Reply #3 on: December 10, 2011, 04:55:08 PM »

Hi Smiley.

This stuff is good!

I am using named as a part of my Internet Connection Sharing - it's my DNS server so I already have all the tools needed. What I did was:

Edited this file:

Code:
/etc/resolvconf/resolv.conf.d/base

so it looks like this:

Quote
[root@icsserver andrzejl]# cat /etc/resolvconf/resolv.conf.d/base
nameserver 127.0.0.1

No empty lines at the end.

and then I have edited this file:

Code:
/etc/resolvconf/resolv.conf.d/tail

so it looks like this:

Quote
[root@icsserver andrzejl]# cat /etc/resolvconf/resolv.conf.d/tail
nameserver 208.67.222.222
nameserver 208.67.220.220

Again - no empty lines at the end.

So now when I ran:

Quote
service network restart

and my connection got re-established:

Quote
[root@icsserver andrzejl]# service network restart
Shutting down interface eth1:                                              [  OK  ]
Shutting down interface ppp0:                                              [  OK  ]
Shutting down loopback interface:                                          [  OK  ]
Disabling IPv4 packet forwarding:                                          [  OK  ]
Bringing up loopback interface:                                            [  OK  ]
Enabling IPv4 packet forwarding                                            [  OK  ]
Configuring wireless regulatory domain                                     [  OK  ]
Bringing up interface eth1:                                                [  OK  ]
Bringing up interface ppp0:                                                [  OK  ]
[root@icsserver andrzejl]#

I am getting this in my:

Code:
/etc/resolv.conf

Quote
[root@icsserver andrzejl]# cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(Cool
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.0.1
nameserver 208.67.222.222
nameserver 208.67.220.220

Why this way? Because I am using 3G USB Dongle from three.ie and I don't get to setup my own DNS while connecting. The only way to setup my own DNS for 3G network is to override it with the resolvconf daemon Smiley.

BUT that's not the point Wink!

This is the point Smiley.

First shot:

Quote
[andrzejl@icsserver ~]$ dig pclinuxos.com

; <<>> DiG 9.8.1-P1 <<>> pclinuxos.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10203
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 0

...

;; Query time: 265 msec

...

;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sat Dec 10 21:41:28 2011
;; MSG SIZE  rcvd: 131

Quote
[andrzejl@icsserver ~]$ dig pclinuxos.com

; <<>> DiG 9.8.1-P1 <<>> pclinuxos.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 8272
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 2

...

;; Query time: 1 msec

...

;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sat Dec 10 21:41:29 2011
;; MSG SIZE  rcvd: 163

Nice difference and the sites are loading slightly faster! Wink.

Thanks Janasx1!
Logged

janasx1
Full Member
***
Offline Offline

Posts: 111



« Reply #4 on: December 13, 2011, 07:18:04 PM »

Thanks AndrzejL.
I didnt know about the base and tail file.
Logged

HP Pavilion notebook DV6400, AMD Turion TL-64, 2GB RAM, broadcom BCM4312, nvidia Geforce Go 6150
AndrzejL
PCLinuxOS Tester
Super Villain
*******
Offline Offline

Posts: 11990


Registered Linux User #490933


WWW
« Reply #5 on: December 13, 2011, 10:48:32 PM »

Thanks AndrzejL.
I didnt know about the base and tail file.


Cool Smiley there is also a head file Smiley
Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM