docs
uhost
Linux Service Configuration Guide
Optimizing DNS Configuration Method

Optimizing DNS Configuration Method

Step 1 Configuring Redundant DNS Server Address

This can prevent the situation that the domain name cannot be resolved after the DNS Server single point of failure.

Take CentOS as an example:

Open the /etc/resolv.conf file on the host,

If only 1 IP is configured in the file, replace it with the following 2 IPs according to the following list:

Data Center/Availability ZoneIP
Beijing Zone B10.9.255.1, 10.9.255.2
Beijing Zone C10.10.255.1, 10.10.255.2
Beijing Zone D10.19.255.1, 10.19.255.2
Beijing Zone E10.42.255.1, 10.42.255.2
Ulanqab Zone A100.65.128.2, 100.65.128.3
Guangdong Zone B10.13.255.1, 10.13.255.2
Hong Kong Zone A and B10.8.255.1, 10.8.255.2
Los Angeles Zone A10.11.255.1, 10.11.255.2
Singapore Zone B10.35.224.212, 10.35.250.52
Singapore Zone A10.35.255.1, 10.35.255.2
Bangkok, Thailand Zone A10.31.255.1, 10.31.255.2
Washington Zone A10.27.255.1, 10.27.255.2
Frankfurt, Germany Zone A10.29.255.1, 10.29.255.2
Seoul, South Korea Zone A10.33.255.1, 10.33.255.2
Moscow, Russia Zone A10.39.255.1, 10.39.255.2
Tokyo, Japan Zone A10.40.255.1,10.40.255.2
Taipei, Taiwan Zone A10.41.255.1,10.41.255.2
Dubai, UAE Zone A10.44.255.1,10.44.255.2
Jakarta, Indonesia Zone A10.45.255.1,10.45.255.2
Mumbai, India Zone A10.47.255.1,10.47.255.2
Sao Paulo, Brazil Zone A10.49.255.1,10.49.255.2
London, UK Zone A10.50.255.1,10.50.255.2
Manila Zone A100.64.48.2,100.64.48.3
Bangkok, Thailand Zone B10.31.255.11,10.31.255.10
Lagos Zone A10.52.255.1,10.52.255.2
Ho Chi Minh, Vietnam Zone A100.64.0.2,100.64.0.3
Shanghai Zone B10.23.255.1,10.23.255.2

Step 2 Enable NSCD Service

In Linux, turning on the NSCD service can locally cache the DNS resolution result. During the TTL time, there is no need to repeatedly resolve the DNS server, which speeds up the DNS resolution speed and alleviates the pressure on the DNS server.

Take CentOS as an example:

1、Install

yum install nscd

2、Add configuration file /etc/nscd.conf

Content is as follows:

#
# /etc/nscd.conf
#
# An example Name Service Cache config file. This file is needed by nscd.
#
# Legal entries are:
#
#       logfile                 <file>
#       debug-level             <level>
#       threads                 <initial #threads to use>
#       max-threads             <maximum #threads to use>
#       server-user             <user to run server as instead of root>
#               server-user is ignored if nscd is started with -S parameters
#       stat-user               <user who is allowed to request statistics>
#       reload-count            unlimited|<number>
#       paranoia                <yes|no>
#       restart-interval        <time in seconds>
#
#       enable-cache            <service> <yes|no>
#       positive-time-to-live   <service> <time in seconds>
#       negative-time-to-live   <service> <time in seconds>
#       suggested-size          <service> <prime number>
#       check-files             <service> <yes|no>
#       persistent              <service> <yes|no>
#       shared                  <service> <yes|no>
#       max-db-size             <service> <number bytes>
#       auto-propagate          <service> <yes|no>
#
# Currently supported cache names (services): passwd, group, hosts, services
#
#   logfile                 /var/log/nscd.log
    threads                 4
    max-threads             32
    server-user             nscd
    stat-user               somebody
    debug-level             5
    reload-count            5
    paranoia                no
    restart-interval        3600
 
 
    enable-cache            hosts           yes
    enable-cache            passwd          no
    enable-cache            group           no
    enable-cache            services        no
    positive-time-to-live   hosts           5
    negative-time-to-live   hosts           20
    suggested-size          hosts           211
    check-files             hosts           yes
    persistent              hosts           yes
    shared                  hosts           yes
    max-db-size             hosts           33554432
```markdown
 
### 3、Start service
 
    service nscd start
 
### 4、Add to startup
 
    chkconfig nscd on
 
### 5、If you need to stop the service
 
    service nscd stop
  • Company
  • ContactUs
  • Blog
Copyright © 2024 SurferCloud All Rights Reserved