Table of Contents
1 Introduction
For whatever reason, after I upgraded to Ubuntu's Karmic Koala (9.10) (review here and here) browsing was very slow. Or rather it was slow when my laptop was hooked into one network, but not another.
It seemed to be caused by the DNS nameserver configuration.
I did some research and found that changing DNS nameservers is a piece of cake.
What's is DNS and how does it work? Read this Wiki entry for the details. The short answer is that DNS is the Internet's phonebook. DNS nameservers convert names (like LinuxDoe.blogspot.com ) into IP addresses, just like the traditional phone book converts names into telephone numbers.
There at least three DNS nameservers that you can choose from, right now. You can pick the one you want.
Not only could this affect the speed at which you cruise the Internet, but a DNS nameserver might provide a phishing filter, domain blocking, and typo correction.
2 What DNS Nameserver Am I Using Right Now?
The DNS nameserver that you're currently using is in the file
/etc/resolv.conf/
kes@Cyclone:~$ cat /etc/resolv.conf # Generated by NetworkManager nameserver 8.8.8.8 nameserver 8.8.8.4 kes@Cyclone:~$
The first namserver listed is the primary and the second is the
secondary.(8.8.8.8 and 8.8.8.4, for those in the know are the Google
DNS nameservers. More about that later.)
For the next section, you'll also need the name of your network interface.
kes@Cyclone:/etc/modprobe.d$ ifconfig -s # netstat -i works too kes@Cyclone:/etc/modprobe.d$ ifconfig -s #netstat -i works too Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg eth0 1500 0 187707 0 0 0 126029 0 0 0 BMRU lo 16436 0 102 0 0 0 102 0 0 0 LRU
3 Change To Another DNS
The easiest way to do this is to edit /etc/resolv.conf. And then bounce the
interface (you'll have to use the name of your interface).
kes@Cyclone:~$ sudo cp /etc/resolv.conf /etc/resolv.conf.bak kes@Cyclone:~$ sudo vim /etc/resolv.conf kes@Cyclone:~$ sudo ifconfig eth0 down && ifconfig eth0 up # You Iface may not be eth0
But this won't work if you're using DHCP (you probably are), because it will
overwrite your /etc/resolv.conf file.
In that case, modify =/etc/dhcp3/dhclient.conf
# Configuration file for /sbin/dhclient, which is included in Debian's # dhcp3-client package. # # This is a sample configuration file for dhclient. See dhclient.conf's # man page for more information about the syntax of this file # and a more comprehensive list of the parameters understood by # dhclient. # # Normally, if the DHCP server provides reasonable information and does # not leave anything out (like the domain name, for example), then # few changes must be made to this file, if any. # option rfc3442-classless-static-routes code 121 = array of unsigned integer 8; send host-name "<hostname>"; #send dhcp-client-identifier 1:0:a0:24:ab:fb:9c; #send dhcp-lease-time 3600; #supersede domain-name "fugue.com home.vix.com"; #prepend domain-name-servers 127.0.0.1;
See the last line? Modify it so it looks like this: prepend domain-name-servers 8.8.8.8,8.8.4.4;
The IP addresses 8.8.8.8,8.8.4.4 are the Google Public DNS nameservers.
Don't forget to bounce your interface.
kes@Cyclone:~$ sudo ifconfig eth0 down && ifconfig eth0 up # You Iface may not be eth0
The above is pretty good, but if you're using DHCP, you'll end up with a
/etc/resolv.conf that looks like this.
kes@Cyclone:/etc/dhcp3$ cat ../resolv.conf # Generated by NetworkManager nameserver 8.8.8.8 nameserver 8.8.4.4 nameserver 10.1.10.1
Which is not altogether bad.
Another way to modify your nameservers is as follows:
- System menu => Preferences, => Network Connections.
- Select the network interface. (Perhaps called eth0)
- Edit => IPv4 Settings.
- In the dropdown, select Automatic (DHCP) addresses only.
- In the DNS servers field, enter "8.8.8.8 8.8.4.4" (without the double quotes and don't forget the space).
- Click Apply
In the above, number 4 means that you are going to use DHCP, but DHCP should not automatically get the address of the DNS nameservers. This allows you to specify the DNS nameserves in the DNS servers field.
And now the resolv.conf looks like this:
kes@Cyclone:/etc/dhcp3$ cat ../resolv.conf # Generated by NetworkManager nameserver 8.8.8.8 nameserver 8.8.4.4
4 Other DNS Nameservers
5 Conclusion
Congratulations! You have just learned how to configure your DNS nameservers!
No comments:
Post a Comment