用指定的端口代替默认的DNS 53端口,如果设置为0,则完全禁止DNS功能,只使用dhcp服务 port=5353 以下两个参数告诉Dnsmasq过滤一些查询:1.哪些公共DNS没有回答 2.哪些root根域不可达。 从不转发格式错误的域名 #domain-needed 从不转发不在路由地址中的域名 #bogus-priv resolv-file配置Dnsmasq额外的向流的DNS服务器,如果不开启就使用linux主机默认的/etc/resolv.conf里的nameserver,通过下面的选项指定其他文件。 resolv-file=/etc/dnsmasq.d/upstream_dns.conf 默认情况下Dnsmasq会发送查询到它的任何上游DNS服务器上,如果取消注释,则Dnsmasq则会严格按照/etc/resolv.conf中的DNS Server顺序进行查询。 #strict-order 以下两个参数控制是否通过/etc/resolv.conf确定上游服务器,是否检测/etc/resolv.conf的变化,则取消注释。 如果你不想Dnsmasq读取/etc/resolv.conf文件或者其他文件,获得它的servers # If you don't want dnsmasq to read /etc/resolv.conf or any other # file, getting its servers from this file instead (see below), then # uncomment this. #no-resolv 如果你不允许Dnsmasq通过轮询/etc/resolv.conf或者其他文件来获取配置的改变,则取消注释。 #no-poll 增加一个name server,一般用于内网域名 #server=/localnet/192.168.0.1 设置一个反向解析,所有192.168.3.0/24的地址都到10.1.2.3去解析 #server=/3.168.192.in-addr.arpa/10.1.2.3 增加一个本地域名,会在/etc/hosts中进行查询 #local=/localnet/ 增加一个域名,强制解析到你指定的地址上 #address=/double-click.net/127.0.0.1 同上,还支持ipv6 #address=/www.thekelleys.org.uk/fe80::20d:60ff:fe36:f83 增加查询yahoo google和它们的子域名到vpn、search查找 # Add the IPs of all queries to yahoo.com, google.com, and their # subdomains to the vpn and search ipsets: #ipset=/yahoo.com/google.com/vpn,search 你还可以控制Dnsmasq和Server之间的查询从哪个网卡出去 # server=10.1.2.3@eth1 指定源地址携带10.1.2.3地址和192.168.1.1的55端口进行通讯 # and this sets the source (ie local) address used to talk to # 10.1.2.3 to 192.168.1.1 port 55 (there must be a interface with that # IP on the machine, obviously). # server=10.1.2.3@192.168.1.1#55 改变Dnsmasq默认的uid和gid #user= #group= 如果你想Dnsmasq监听某个端口为dhcp、dns提供服务 #interface= 你还可以指定哪个端口你不想监听 #except-interface= 设置想监听的地址,如果你本机要使用写上127.0.0.1。 #listen-address= 如果你想在某个端口只提供dns服务,则可以进行配置禁止dhcp服务 #no-dhcp-interface= # On systems which support it, dnsmasq binds the wildcard address, # even when it is listening on only some interfaces. It then discards # requests that it shouldn't reply to. This has the advantage of # working even when interfaces come and go and change address. If you # want dnsmasq to really bind only the interfaces it is listening on, # uncomment this option. About the only time you may need this is when # running another nameserver on the same machine. #bind-interfaces 如果你不想使用/etc/hosts,则取消下面的注释 #no-hosts 如果你项读取其他类似/etc/hosts文件,则进行配置 addn-hosts=/etc/banner_add_hosts 自动的给hosts中的name增加一个域名 #expand-hosts 给dhcp服务赋予一个域名 #domain=thekelleys.org.uk 给dhcp的一个子域赋予一个不同的域名 #domain=wireless.thekelleys.org.uk,192.168.2.0/24 同上,不过子域是一个范围 #domain=reserved.thekelleys.org.uk,192.68.3.100,192.168.3.200 dhcp分发ip的范围,以及每个ip的租约时间 #dhcp-range=192.168.0.50,192.168.0.150,12h 同上,不过给出了掩码 #dhcp-range=192.168.0.50,192.168.0.150,255.255.255.0,12h 自动加载conf-dir目录下的配置文件 conf-dir=/etc/dnsmasq.d 设置dns缓存大小,默认为150条 cache-size=150
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了