Friday 21 December 2012

How do I configure my static DNS

If you are connected to the local network and your system obtained an IP from the service provider, yet you are not able to ping the services on the network, as:

$ ping google.com

and you recieves this message:

ping: unknown host google.com

Don't be panic, this in because your system does not able to resolve the DNS server. For this you have to give the DNS in the following file:

$ sudo vim /etc/resolv.conf

and give the nameserver-dns here as:

nameserver 8.8.8.8
nameserver 8.8.4.4

That works fine and you will connect to the various services on the internet.
----------------------------------------------------------------------------------------------------------------------------------

BUT

This file is for,
Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
and 
DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN

This means as you power off your system, the content written in the file would be deleted, so to add the static DNS permanently, you shlold have to change in the following file

$ sudo vim /etc/neywork/interfaces

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
            address 192.168.15.111
            netmask 255.255.255.0
            gateway 192.168.15.1
            dns-nameserver 8.8.8.8 8.8.4.4

And don't forget to restart the network by:

$ sudo /etc/init.d/networking restart

No comments:

Post a Comment