How to setup DNS server In Linux - Fix DNS resolve issue on a Linux VPS

If you get subscribed with our VPS hosting service you would face issues to browse internet from your VPS while your VPS is accessible from internet. You would get this issue because of wrong name server entries in /etc/resolve.conf file on your Linux VPS. This is known issue with our Linux VM template.

To fix this issue, you are reqired to edit DNS entries:

For CentOS
Edit name server to any public DNS i.e. google dns server 8.8.8.8 in resolve.conf
vi  /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4

For Ubuntu:
vi  /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4

Type route command to see kernel routing table. If you see 8.0.0.0 entry in routing table, you will require to delete this entry from routing table of your Ubuntu VPS. the output would look like this:
route

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         69-46-26-33.sta 0.0.0.0           UG    0      0        0 eth0
8.0.0.0              *               255.0.0.0               U     0      0        0 eth0
69.46.26.32     *               255.255.255.224 U     0      0        0 eth0


OR try with ip route command
ip route list

default via 69.46.26.33 dev eth0
8.0.0.0/8 dev eth0  proto kernel  scope link  src 8.0.0.0
69.46.26.32/27 dev eth0  proto kernel  scope link  src 69.46.26.40

Issue below command to delete conflicting route:
route del -net 8.0.0.0 netmask 255.0.0.0     
     
OR
ip route del 8.0.0.0/8 dev eth0

If you willing to use alternative DNS / other open DNS service, please also execute below command on Ubuntu VPS:
resolvconf --disable-updates


List of public DNS servers:
Google:
8.8.8.8
8.8.4.4

Google Public DNS IPv6 Addresses:
2001:4860:4860::8888
2001:4860:4860::8844

OpenDNS
208.67.222.222
208.67.220.220

Level 3 Public DNS:
209.244.0.3
209.244.0.4
4.2.2.1
4.2.2.2
4.2.2.3
4.2.2.4


Norton DNS IP Addresses:
Option A:
199.85.126.10
199.85.127.10

  • 38 Users Found This Useful
Was this answer helpful?
Related Articles
Copyright © 2020 Temok IT Services. All Rights Reserved.
Positive SSL