/etc/dnsmasq.conf 

#DNS服务器的地址,就是我的热点的地址 

listen-address=192.168.1.1 

#设置DHCP分配的地址范围和时间 

dhcp-range=192.168.1.10,192.168.1.20,1h 

#设定网关的地址,当然还是我热点的地址 

dhcp-option=3,192.168.1.1 

#重头戏来了,设定DNS服务器,可悲之前怎么也找不到设定的办法。。。还说是要使用DNS中继。。然后就呵呵了 

dhcp-option=option:dns-server,114.114.114.114,8.8.4.4

然后 

/etc/init.d/dnsmasq start 

启动DHCP服务器


实例配置文件:

# DNS

strict-order

cache-size=1500

conf-dir=/etc/dnsmasq.d

# DHCP

dhcp-option=3,172.16.1.1

dhcp-lease-max=200

dhcp-leasefile=/var/lib/dnsmasq/dnsmasq.leases

interface=enp3s0

dhcp-range=172.16.1.10,172.16.1.100,12h

给网卡为  enp3s0的网卡口自动分配ip地址,ip 区间   172.16.1.10,172.16.1.100