4-4. DNSmasq Construction Manual

I. Dns
DNSmasq is a small and convenient tool for configuring DNS and DHCP, which is suitable for small networks. It provides DNS function and optional DHCP function. It serves domain names that are only applicable locally, and these domain names will not appear in DNS servers around the world. DHCP server combines with DNS server, and allows the address assigned by DHCP to be resolved normally in DNS. These DHCP assigned addresses and related commands can be configured to each host or a core device (such as a router). DNSmasq supports static and dynamic DHCP configurations.

1) Install Dnsmasq software on the server

[root@localhost ~]# yum -y install dnsmasq                 //Installation services
[root@localhost ~]# vi /etc/dnsmasq.conf                       //Modify master profile

domain-needed                       //note off
ogus-priv                           //note off
strict-order                            //note off
server=/example.com/         //Add resolution record
expand-hosts                        //note off  
domain=lee.com                  //Local domain name
[root@localhost ~]# systemctl restart dnsmasq / / service restart

[root@localhost ~]# vi /etc/hosts / / write the hosts file, indicating the server  lee.com
[root@localhost ~]# systemctl restart dnsmasq

2) Firewall release

[root@localhost ~]# firewall-cmd --add-service=dns --permanent             
[root@localhost ~]# firewall-cmd --reload

3) Test analysis ~
ping example.com


1) Start DHCP configuration in Dnsmasq as follows

[root@localhost ~]# vi /etc/dnsmasq.conf

dhcp-range=,,12h                //Set address range
dhcp-option=option:router,                    //Set up gateway

dhcp-option=option:netmask,            //Subnet mask
dhcp-option=option:dns-server,                //Dns
dhcp-option=option:ntp-server,               //ntp

[root@localhost ~]# systemctl restart dnsmasq / / restart the service

2) Set up firewall

[root@localhost ~]# firewall-cmd --add-service=dhcp --permanent        
[root@localhost ~]# firewall-cmd --reload 

3) DHCP setup completed ~

Keywords: DNS firewall yum

Added by verlen on Wed, 06 May 2020 03:49:13 +0300