Showing posts with label DNS. Show all posts
Showing posts with label DNS. Show all posts

Add DNS Server Address In Ubuntu Fedora Centos Redhat etc

After installing a Linux Operating system and configuring a Static ip address, you may need to add one or more DNS servers to resolve names. Then only you can communicate with domain names of websites and other servers. You can add more than one DNS server addresses as primary, secondary and so on.

This configuration should work in all Linux distributions like Redhat, CentOS, Ubuntu, Debian, Fedora, etc


Without a DNS server
Without a DNS server you can communicate with all servers by their ip addresses, and cannot communicate by their domain names.
[root@server ~]#  ping facebook.com
ping: unknown host facebook.com

Add DNS server Addresses
Add your DNS server address to the configuration file located in "/etc/resolv.conf"  as below. here i added Google's public DNS server addresses as my DNS server.
[root@server ~]# vi /etc/resolv.conf
nameserver 8.8.4.4
nameserver 8.8.4.4
#Now save the resolv.conf configuration file




Add DNS server in Interface config file
In RPM based Distributions like Redhat, CentOS, Fedora You can also add DNS server information in Network interface configuration file located in  
/etc/sysconfig/network-scripts/ifcfg-ethX
[root@server ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
IPADDR=192.168.10.50
NETMASK=255.255.255.0
BOOTPROTO=static
ONBOOT=yes
GATEWAY=192.168.10.1
DNS1=192.168.10.2
DNS2=192.168.10.3
DNS3=192.168.10.4

Test DNS Server
You not need to restart network daemon, 
Just go to browser and connect to any websites by name 
ping to websites
or [root@server ~]# host facebook.com
facebook.com has address 69.171.229.11
facebook.com has address 66.220.149.11
facebook.com has address 69.171.224.11
facebook.com mail is handled by 10 smtpin.mx.facebook.com.

Google's Public DNS Servers

If your Internet Service Provider's Name server not working properly, frequent doun or may feel bit slower in name resolving, use Google's public DNS servers for faster name resolving.

Google has different name servers for both IPv4 and IPv6 protocols. 

By using Google DNS server you can bypass some restrictions (if applied) in your ISP's name server. So you can access the complete web domains.  
The Google Public DNS IP addresses (IPv4) 
8.8.8.8
8.8.4.4
The Google Public DNS  addresses (IPv6)
2001:4860:4860::8888
2001:4860:4860::8844

You can use these above DNS servers by replacing your current using ISP's DNS servers or along with it (as alternate DNS server). 

Related Posts Plugin for WordPress, Blogger...

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Bluehost Coupons