DNS configuration for Linux under DNSMASQ

Source: Internet
Author: User

At the beginning of the year, passed the RHCE examination, the only experience is through the system of learning, the knowledge of the Linux system a comb, found that the RHCE exam can only solve the basic system maintenance, relative to the deeper Linux system applications there is a long way to go. So we started to learn how to configure various service applications.

The first is the configuration of the most basic DNS service. Originally wanted to directly use the Linux bind service, found that the CentOS default is not installed, and DNSMASQ is the default installation, the first DNSMASQ the DNS simple function to configure a bit.


Find some information that the DNSMASQ function is more powerful, not only can realize the DNS service, also can realize the DHCP service. Think of the road to take a step by step, rice to eat a mouthful. First of all, the simplest DNS to say it.


First of all, we use the method that the teacher teaches when we take part in textual research.

1. Installation Services

2. Modify the configuration file

3, set up service boot, start the service

4. Configure firewall, SELinux, etc.


Since DNSMASQ is already installed, go straight to the second step and modify the configuration file.


Vim/etc/dnsmasq.conf

Make a few changes where you need to modify.

1. Configure resolv-file files to ensure that the original resolv.conf of the machine is not destroyed.

Resolv-file=/etc/resolv.dnsmasq.conf

2, remove the comments, in accordance with the resolv.dnsmasq.conf order

Strict-order

3. Use DNS server for local area network, listen to native IP address

listen-address=192.168.14.26,127.0.0.1

4. Set the cache size

cache-size=150

5, modify the DNSMASQ configuration file, and DNSMASQ read the Hosts file

Conf-dir=/etc/dnsmasq.d

Addn-hosts=/etc/dnsmasq.hosts

6, add the address that needs to be resolved

Analysis of address=/oa.cloud-dbm.com/192.168.13.38 Setting intranet

address=/sz.cloud-dbm.com/192.168.13.32

Server=/cn/114.114.114.114 set CN domain name from DNS server 114.114.114.114 resolution


Step Three

Systemctl Enable Dnsmasq.service

Systemctl Start Dnsmasq.service


Fourth Step

Configuring firewalls

Firewall-cmd--permanent--add-service=dns

Firewall-cmd--reload


Fifth Step

To see if DNS 53 ports are listening properly

Netstat-tunlp|grep 53

TCP 0 0 0.0.0.0:53 0.0.0.0:* LISTEN 1554/dnsmasq

TCP6 0 0::: +:::* LISTEN 1554/DNSMASQ

UDP 0 0 0.0.0.0:53 0.0.0.0:* 1554/dnsmasq

UDP 0 0 0.0.0.0:5353 0.0.0.0:* 888/avahi-daemon:r

UDP6 0 0::: +:::* 1554/dnsmasq


Easy to complete.


DNS configuration for Linux under DNSMASQ

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.