【转载】关于dnsmasq的使用配置和文档翻译

[复制链接]
大黄鸭 发表于 2017-8-23 21:25 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题
nsmasq是什么我就不说了,请自行百度。
目前我需要使用的用途是:
1.dhcp(分配一个或者多个内网ip地址)
2.dns(锁定解析,改变解析指向和dns缓存)
3.简便,一次满足dhcp和dns 2个功能
备注:
dhcp是用udp 67端口的,dns是用tcp/udp 53端口的,有iptables的请自行处理

如何安装:
因为他方便小巧,性价比高,所以我yum了
yum install dnsmasq

如何启动关闭 重启
  1. service dnsmasq stop
复制代码

Shutting down dnsmasq:                                     [  OK  ]
  1. service dhcrelay start
复制代码

Starting dhcrelay:          [OK]

如何查看日志
tail -f /var/log/messages

目前我用到的配置,请各位参考对号入座:


  1. resolv-file=/etc/resolv.dnsmasq.conf
  2. server=/testdns.com/172.16.0.1
  3. address=/www.test.com/192.168.0.12
  4. interface=p3p1
  5. listen-address=127.0.0.1,172.16.0.1
  6. bind-interfaces
  7. addn-hosts=/etc/dnsmasq.host
  8. dhcp-range=172.16.0.30,172.16.1.254,255.255.128.0,30m
  9. dhcp-host=B8:EE:65:D2:F9:B4,fred,172.16.1.139
  10. dhcp-option=3,172.16.0.1
  11. dhcp-option=19,0 # option ip-forwarding off
  12. dhcp-option=44,0.0.0.0 # set netbios-over-TCP/IP nameserver(s) aka WINS server(s)
  13. dhcp-option=45,0.0.0.0 # netbios datagram distribution server
  14. dhcp-option=46,8 # netbios node type
  15. dhcp-lease-max=500
  16. dhcp-leasefile=/var/lib/dnsmasq/dnsmasq.leases
  17. cache-size=1000
  18. dhcp-option=252,"\n"

复制代码




详细配置翻译在这里:
btw:
感谢jianshu不支持代码格式化 - 。-


  1. Configuration file for dnsmasq.

  2. Format is one option per line, legal options are the same
  3. as the long options legal on the command line. See
  4. "/usr/sbin/dnsmasq --help" or "man 8 dnsmasq" for details.

  5. The following two options make you a better netizen, since they
  6. tell dnsmasq to filter out queries which the public DNS cannot
  7. answer, and which load the servers (especially the root servers)
  8. uneccessarily. If you have a dial-on-demand link they also stop
  9. these requests from bringing up the link uneccessarily.

  10. Never forward plain names (without a dot or domain part)
  11. 不转发无格式的域名(没有.的或者只有一部分的残缺域名)【不常用】
  12. domain-needed
  13. Never forward addresses in the non-routed address spaces.
  14. 在未发送的地址空间内不转发域名地址,根据上下文信息,我的理解是在不通的网络环境下不做转发【不常用】
  15. bogus-priv

  16. Uncomment this to filter useless windows-originated DNS requests
  17. which can trigger dial-on-demand links needlessly.
  18. Note that (amongst other things) this blocks all SRV requests,
  19. so don't use it if you use eg Kerberos, SIP, XMMP or Google-talk.
  20. This option only affects forwarding, SRV records originating for
  21. dnsmasq (via srv-host= lines) are not suppressed by it.
  22. 这是跟ad相关的东西,微软的特殊请求包,如果要使用kerberos,sip,xmmp gtlak那些就需要打开配置【不常用】
  23. 引用信息:http://www.cnblogs.com/zhuangxuqiang/archive/2009/04/28/1445113.html
  24. filterwin2k

  25. Change this line if you want dns to get its upstream servers from
  26. somewhere other that /etc/resolv.conf
  27. 这个是很有用的东西,因为你要做自定义dns控制的话,最好单独独立一份dns服务器地址清单,系统默认的/etc/resolv.conf是会变化的,尤其是新版本的linux系统会跟随网卡配置变化或者其他网络管理套件变化,为了可靠性,单独独立一份出来管理,所以需要打开这个配置
  28. resolv-file=

  29. By default, dnsmasq will send queries to any of the upstream
  30. servers it knows about and tries to favour servers to are known
  31. to be up. Uncommenting this forces dnsmasq to try each query
  32. with each server strictly in the order they appear in
  33. /etc/resolv.conf
  34. 强制按照resolv.conf的dns服务器顺序来进行解析,可能会有时候上游dns服务器的不稳定,可能a.dns服务器最近解析很慢,b.dns服务器最近解析很快,那么调整一下顺序,先走a再到b,你可以找到一个稳定的dns服务器使用顺序,这样也可以使用这个配置来优化一下,一般情况没必要【不常用】
  35. strict-order

  36. If you don't want dnsmasq to read /etc/resolv.conf or any other
  37. file, getting its servers from this file instead (see below), then
  38. uncomment this.
  39. 不使用/etc/resolv.conf来进行上游dns服务器解析,这里跟上面的resolv-file配置配合使用,打开了这个配置然后指定一个新的resolv-file
  40. no-resolv

  41. If you don't want dnsmasq to poll /etc/resolv.conf or other resolv
  42. files for changes and re-read them then uncomment this.
  43. 这个是是否轮训dns解析,例如a.dns解析不了去b.dns然后b.dns不行了又去a.dns【不常用】
  44. no-poll

  45. Add other name servers here, with domain specs if they are for
  46. non-public domains.
  47. 配置内网其他dns服务器的域名解析,一般来说用dnsmasq的环境不是复杂环境,所以不需要那么多【不常用】
  48. server=/localnet/192.168.0.1

  49. Example of routing PTR queries to nameservers: this will send all
  50. address->name queries for 192.168.3/24 to nameserver 10.1.2.3
  51. 反向解析记录,一般用于邮件系统,正向解析就是从域名到ip这样解析,反向就是从ip到域名【不常用】
  52. server=/3.168.192.in-addr.arpa/10.1.2.3

  53. Add local-only domains here, queries in these domains are answered
  54. from /etc/hosts or DHCP only.
  55. 设置本机使用域名,或许一些一定要用本机域名的程序要用,但不常见【不常用】
  56. local=/localnet/

  57. Add domains which you want to force to an IP address here.
  58. The example below send any host in doubleclick.net to a local
  59. webserver.
  60. 这个是好家伙,强制解析,类似写host的效果,这样可以做域名绑定,避免被dns污染,也支持泛解析*号,现在世界都很危险,还是要保留内心的一丝纯洁的
  61. address=/doubleclick.net/127.0.0.1

  62. --address (and --server) work with IPv6 addresses too.
  63. 上面配置的加强版,支持ipv6
  64. address=/www.thekelleys.org.uk/fe80::20d:60ff:fe36:f83

  65. You can control how dnsmasq talks to a server: this forces
  66. queries to 10.1.2.3 to be routed via eth1
  67. 控制某台dns的解析请求从某个网卡出去【不常用】
  68. --server=10.1.2.3@eth1

  69. and this sets the source (ie local) address used to talk to
  70. 10.1.2.3 to 192.168.1.1 port 55 (there must be a interface with that
  71. IP on the machine, obviously).
  72. 指定一个源地址去访问某个目标地址的某个端口,有点类似iptables的forward,实现原理不太懂,但这个会有用途的,例如强制门户,做中转,内网会较常用,简单的重定向,跟address作用类似
  73. [email protected]

  74. If you want dnsmasq to change uid and gid to something other
  75. than the default, edit the following lines.
  76. 简单易懂就不说了
  77. user=
  78. group=

  79. If you want dnsmasq to listen for DHCP and DNS requests only on
  80. specified interfaces (and the loopback) give the name of the
  81. interface (eg eth0) here.
  82. Repeat the line for more than one interface.
  83. 指定监听某个接口,例如某张网卡,
  84. interface=
  85. Or you can specify which interface not to listen on
  86. 指定排除监听某个接口
  87. except-interface=
  88. Or which to listen on by address (remember to include 127.0.0.1 if
  89. you use this.)
  90. 这个是重要选项,监听地址,要写上ip地址加上127.0.0.1,因为IP地址是给你的client机用的,127.0.0.1是给dnsmasq用的,为什么呢,是因为你要做dns缓存,要访问自己即是本机,格式就是ip,127.0.0.1
  91. listen-address=
  92. If you want dnsmasq to provide only DNS service on an interface,
  93. configure it as shown above, and then use the following line to
  94. disable DHCP on it.
  95. 只提供dns服务,不提供dhcp服务,这个是因为一个内网是不可能有多台dhcp服务器的,多个dhcp会导致dhcp广播混乱,可能会造成的影响就是我分到了一个ip却上不了网,因为分给你ip的dhcp服务器是给上内网用的。
  96. no-dhcp-interface=

  97. On systems which support it, dnsmasq binds the wildcard address,
  98. even when it is listening on only some interfaces. It then discards
  99. requests that it shouldn't reply to. This has the advantage of
  100. working even when interfaces come and go and change address. If you
  101. want dnsmasq to really bind only the interfaces it is listening on,
  102. uncomment this option. About the only time you may need this is when
  103. running another nameserver on the same machine.
  104. 绑定了网卡之后会保证dnsmasq不去骚扰其他网卡,保证请求不乱发,一般跟interface一起使用
  105. bind-interfaces

  106. If you don't want dnsmasq to read /etc/hosts, uncomment the
  107. following line.
  108. 是否使用hosts,如果你在上面的都指定好了固定的解析,如server=/localnet/192.168.0.1 那么可以只使用这个解析,不用hosts,不过嘛,hosts方便一点,而且hosts可以在dns挂了的情况下剩下,虽然只是本机服务器生效,还是建议用hosts的,只要整理好解析和hosts的列表就好了
  109. no-hosts
  110. or if you want it to read another file, as well as /etc/hosts, use
  111. this.
  112. 使用另外一个文件代替hosts,这样就可以不骚扰本机的host 从而保证服务器固有host不被影响,也可以给dnsmasq使用特别的hosts
  113. addn-hosts=/etc/banner_add_hosts

  114. Set this (and domain: see below) if you want to have a domain
  115. automatically added to simple names in a hosts-file.
  116. 自动给hosts的域名增加一个简单的名字,搭配下面的domain用的,【不常用】
  117. expand-hosts

  118. Set the domain for dnsmasq. this is optional, but if it is set, it
  119. does the following things.
  120. 1) Allows DHCP hosts to have fully qualified domain names, as long
  121. as the domain part matches this setting.
  122. 2) Sets the "domain" DHCP option thereby potentially setting the
  123. domain of all systems configured by DHCP
  124. 3) Provides the domain part for "expand-hosts"
  125. 给dhcp服务器赋予一个域名,个人感觉不需要
  126. domain=thekelleys.org.uk

  127. Set a different domain for a particular subnet
  128. 给一个dhcp子域一个域名,蛋疼了,还没想到为嘛要这样做,dhcp只是一个分配ip的叔叔,不过在ad服务器之类的环境是需要dns后缀的,因为ad需要客户端的域名来找到主机
  129. domain=wireless.thekelleys.org.uk,192.168.2.0/24

  130. Same idea, but range rather then subnet
  131. 雷同。
  132. domain=reserved.thekelleys.org.uk,192.68.3.100,192.168.3.200

  133. Uncomment this to enable the integrated DHCP server, you need
  134. to supply the range of addresses available for lease and optionally
  135. a lease time. If you have more than one network, you will need to
  136. repeat this for each network on which you want to supply DHCP
  137. service.
  138. 这个是重要的东西,设置dhcp的ip发配range,就是你的dhcp服务器分配多少个ip出来,ip的范围从哪里到哪里,默认是c类网段,所以简略了掩码,后面增加一个租约时间,dhcp分配的ip是有租约的,租约过了是需要回收的。
  139. dhcp-range=192.168.0.50,192.168.0.150,12h

  140. This is an example of a DHCP range where the netmask is given. This
  141. is needed for networks we reach the dnsmasq DHCP server via a relay
  142. agent. If you don't know what a DHCP relay agent is, you probably
  143. don't need to worry about this.
  144. 这就是标准语法,分配c类网段,12h租约,支持多个subnet,多行写就行了,不过需要注意的是多个网段是需要dhcp中继的,dhcp中继请自行百度,大概就是独立一个网卡,监听dhcp的御用67 udp和tcp端口,连接主dhcp服务器
  145. dhcp-range=192.168.0.50,192.168.0.150,255.255.255.0,12h

  146. This is an example of a DHCP range with a network-id, so that
  147. some DHCP options may be set only for this network.
  148. 可以在分配ip的时候授予这些ip一个名字,也可以叫做network-id,用来识别这个标志是属于这些ip的,用途在下面会说到。但这属于高级功能,还不一定所有client设备都能够支持,所以了解一下按需使用就好了。
  149. dhcp-range=red,192.168.0.50,192.168.0.150

  150. Supply parameters for specified hosts using DHCP. There are lots
  151. of valid alternatives, so we will give examples of each. Note that
  152. IP addresses DO NOT have to be in the range given above, they just
  153. need to be on the same network. The order of the parameters in these
  154. do not matter, it's permissble to give name,adddress and MAC in any order

  155. Always allocate the host with ethernet address 11:22:33:44:55:66
  156. The IP address 192.168.0.60
  157. 绑定网卡地址对应ip地址,用的是host的方式,类似在hosts文件写一个host name 对应一个ip,所以这个不是arp绑定,要区分。
  158. dhcp-host=11:22:33:44:55:66,192.168.0.60

  159. Always set the name of the host with hardware address
  160. 11:22:33:44:55:66 to be "fred"
  161. 绑定mac地址对应一个host name ,我个人觉得绑定mac对应ip就足够了,绑定对应名字比较少见
  162. dhcp-host=11:22:33:44:55:66,fred

  163. Always give the host with ethernet address 11:22:33:44:55:66
  164. the name fred and IP address 192.168.0.60 and lease time 45 minutes
  165. 这个是组合版,绑定某个mac对应fred名字,然后加上一个ip分配,并设置租约,这个只能说是灵活配置的参考,没啥实际意义
  166. dhcp-host=11:22:33:44:55:66,fred,192.168.0.60,45m

  167. Give a host with ethernet address 11:22:33:44:55:66 or
  168. 12:34:56:78:90:12 the IP address 192.168.0.60. Dnsmasq will assume
  169. that these two ethernet interfaces will never be in use at the same
  170. time, and give the IP address to the second, even if it is already
  171. in use by the first. Useful for laptops with wired and wireless
  172. addresses.
  173. 绑定一个ip对应多mac地址,用途场景存在于实验室和无线网络,我想,只是为了让2块网卡用同一个ip这样单纯而纯洁的需求而已【不常用】
  174. dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,192.168.0.60

  175. Give the machine which says its name is "bert" IP address
  176. 192.168.0.70 and an infinite lease
  177. 绑定名字对应ip,并且给了一个新参数,无限租约
  178. dhcp-host=bert,192.168.0.70,infinite

  179. Always give the host with client identifier 01:02:02:04
  180. the IP address 192.168.0.60
  181. 给予一个特殊标识符对应ip,用途不明
  182. dhcp-host=id:01:02:02:04,192.168.0.60

  183. Always give the host with client identifier "marjorie"
  184. the IP address 192.168.0.60
  185. 跟上一条类似,只是标识符还支持普通字符字串
  186. dhcp-host=id:marjorie,192.168.0.60

  187. Enable the address given for "judge" in /etc/hosts
  188. to be given to a machine presenting the name "judge" when
  189. it asks for a DHCP lease.
  190. 用hosts文件的名字来分配ip【不常用】
  191. dhcp-host=judge

  192. Never offer DHCP service to a machine whose ethernet
  193. address is 11:22:33:44:55:66
  194. 使用忽略参数,遇到某个mac网卡的时候不分配ip
  195. dhcp-host=11:22:33:44:55:66,ignore

  196. Ignore any client-id presented by the machine with ethernet
  197. address 11:22:33:44:55:66. This is useful to prevent a machine
  198. being treated differently when running under different OS's or
  199. between PXE boot and OS boot.
  200. 关于pxe的不描述了
  201. dhcp-host=11:22:33:44:55:66,id:*

  202. Send extra options which are tagged as "red" to
  203. the machine with ethernet address 11:22:33:44:55:66
  204. dhcp-host=11:22:33:44:55:66,net:red

  205. Send extra options which are tagged as "red" to
  206. any machine with ethernet address starting 11:22:33:
  207. dhcp-host=11:22:33:::*,net:red

  208. Ignore any clients which are specified in dhcp-host lines
  209. or /etc/ethers. Equivalent to ISC "deny unkown-clients".
  210. This relies on the special "known" tag which is set when
  211. a host is matched.
  212. dhcp-ignore=known

  213. Send extra options which are tagged as "red" to any machine whose
  214. DHCP vendorclass string includes the substring "Linux"
  215. dhcp-vendorclass=red,Linux

  216. Send extra options which are tagged as "red" to any machine one
  217. of whose DHCP userclass strings includes the substring "accounts"
  218. dhcp-userclass=red,accounts

  219. Send extra options which are tagged as "red" to any machine whose
  220. MAC address matches the pattern.
  221. dhcp-mac=red,00:60:8C:::*

  222. If this line is uncommented, dnsmasq will read /etc/ethers and act
  223. on the ethernet-address/IP pairs found there just as if they had
  224. been given as --dhcp-host options. Useful if you keep
  225. MAC-address/host mappings there for other purposes.
  226. 使用额外的文件代替主配置文件来处理dhcp-host的匹配,这个主要为了方便管理,将所有需要用到的dhcp-host配置都搬进去
  227. read-ethers

  228. Send options to hosts which ask for a DHCP lease.
  229. See RFC 2132 for details of available options.
  230. Common options can be given to dnsmasq by name:
  231. run "dnsmasq --help dhcp" to get a list.
  232. Note that all the common settings, such as netmask and
  233. broadcast address, DNS server and default route, are given
  234. sane defaults by dnsmasq. You very likely will not need
  235. any dhcp-options. If you use Windows clients and Samba, there
  236. are some options which are recommended, they are detailed at the
  237. end of this section.

  238. Override the default route supplied by dnsmasq, which assumes the
  239. router is the same machine as the one running dnsmasq.
  240. 设置默认网关,这是指dhcp下发ip后,client的ip获取到的网关信息,很有用,还可以做多种静态路由,3代表默认网关,后面跟ip或者子网
  241. dhcp-option=3,1.2.3.4

  242. Do the same thing, but using the option name
  243. 或者可以直接写关键字router也是代表静态网关
  244. dhcp-option=option:router,1.2.3.4

  245. Override the default route supplied by dnsmasq and send no default
  246. route at all. Note that this only works for the options sent by
  247. default (1, 3, 6, 12, 28) the same line will send a zero-length option
  248. for all other option numbers.
  249. dhcp-option=3

  250. Set the NTP time server addresses to 192.168.0.4 and 10.10.0.5
  251. 设置ntp服务器,不知道怎么验证,暂时不用
  252. dhcp-option=option:ntp-server,192.168.0.4,10.10.0.5

  253. Set the NTP time server address to be the same machine as
  254. is running dnsmasq
  255. dhcp-option=42,0.0.0.0

  256. Set the NIS domain name to "welly"
  257. dhcp-option=40,welly

  258. Set the default time-to-live to 50
  259. TTL现在一般都是指路由跳数了,50足够了。
  260. dhcp-option=23,50

  261. Set the "all subnets are local" flag
  262. dhcp-option=27,1

  263. Send the etherboot magic flag and then etherboot options (a string).
  264. dhcp-option=128,e4:45:74:68:00:00
  265. dhcp-option=129,NIC=eepro100

  266. Specify an option which will only be sent to the "red" network
  267. (see dhcp-range for the declaration of the "red" network)
  268. Note that the net: part must precede the option: part.
  269. dhcp-option = net:red, option:ntp-server, 192.168.1.1

  270. The following DHCP options set up dnsmasq in the same way as is specified
  271. for the ISC dhcpcd in
  272. http://www.samba.org/samba/ftp/docs/textdocs/DHCP-Server-Configuration.txt
  273. adapted for a typical dnsmasq installation where the host running
  274. dnsmasq is also the host running samba.
  275. you may want to uncomment some or all of them if you use
  276. Windows clients and Samba.
  277. 用windows作为client端要把这个带上,这样会快一点获取ip
  278. dhcp-option=19,0 option ip-forwarding off
  279. dhcp-option=44,0.0.0.0 set netbios-over-TCP/IP nameserver(s) aka WINS server(s)
  280. dhcp-option=45,0.0.0.0 netbios datagram distribution server
  281. dhcp-option=46,8 netbios node type

  282. Send RFC-3397 DNS domain search DHCP option. WARNING: Your DHCP client
  283. probably doesn't support this......
  284. dhcp-option=option:domain-search,eng.apple.com,marketing.apple.com

  285. Send RFC-3442 classless static routes (note the netmask encoding)
  286. dhcp-option=121,192.168.1.0/24,1.2.3.4,10.0.0.0/8,5.6.7.8

  287. Send vendor-class specific options encapsulated in DHCP option 43.
  288. The meaning of the options is defined by the vendor-class so
  289. options are sent only when the client supplied vendor class
  290. matches the class given here. (A substring match is OK, so "MSFT"
  291. matches "MSFT" and "MSFT 5.0"). This example sets the
  292. mtftp address to 0.0.0.0 for PXEClients.
  293. dhcp-option=vendor:PXEClient,1,0.0.0.0

  294. Send microsoft-specific option to tell windows to release the DHCP lease
  295. when it shuts down. Note the "i" flag, to tell dnsmasq to send the
  296. value as a four-byte integer - that's what microsoft wants. See
  297. http://technet2.microsoft.com/WindowsServer/en/library/a70f1bb7-d2d4-49f0-96d6-4b7414ecfaae1033.mspx?mfr=true
  298. dhcp-option=vendor:MSFT,2,1i

  299. Send the Encapsulated-vendor-class ID needed by some configurations of
  300. Etherboot to allow is to recognise the DHCP server.
  301. dhcp-option=vendor:Etherboot,60,"Etherboot"

  302. Send options to PXELinux. Note that we need to send the options even
  303. though they don't appear in the parameter request list, so we need
  304. to use dhcp-option-force here.
  305. See http://syslinux.zytor.com/pxe.phpspecial for details.
  306. Magic number - needed before anything else is recognised
  307. dhcp-option-force=208,f1:00:74:7e
  308. Configuration file name
  309. dhcp-option-force=209,configs/common
  310. Path prefix
  311. dhcp-option-force=210,/tftpboot/pxelinux/files/
  312. Reboot time. (Note 'i' to send 32-bit value)
  313. dhcp-option-force=211,30i

  314. Set the boot filename for netboot/PXE. You will only need
  315. this is you want to boot machines over the network and you will need
  316. a TFTP server; either dnsmasq's built in TFTP server or an
  317. external one. (See below for how to enable the TFTP server.)
  318. dhcp-boot=pxelinux.0

  319. Boot for Etherboot gPXE. The idea is to send two different
  320. filenames, the first loads gPXE, and the second tells gPXE what to
  321. load. The dhcp-match sets the gpxe tag for requests from gPXE.
  322. dhcp-match=gpxe,175 gPXE sends a 175 option.
  323. dhcp-boot=net:gpxe,undionly.kpxe
  324. dhcp-boot=mybootimage

  325. Encapsulated options for Etherboot gPXE. All the options are
  326. encapsulated within option 175
  327. dhcp-option=encap:175, 1, 5b priority code
  328. dhcp-option=encap:175, 176, 1b no-proxydhcp
  329. dhcp-option=encap:175, 177, string bus-id
  330. dhcp-option=encap:175, 189, 1b BIOS drive code
  331. dhcp-option=encap:175, 190, user iSCSI username
  332. dhcp-option=encap:175, 191, pass iSCSI password

  333. Test for the architecture of a netboot client. PXE clients are
  334. supposed to send their architecture as option 93. (See RFC 4578)
  335. dhcp-match=peecees, option:client-arch, 0 x86-32
  336. dhcp-match=itanics, option:client-arch, 2 IA64
  337. dhcp-match=hammers, option:client-arch, 6 x86-64
  338. dhcp-match=mactels, option:client-arch, 7 EFI x86-64

  339. Do real PXE, rather than just booting a single file, this is an
  340. alternative to dhcp-boot.
  341. pxe-prompt="What system shall I netboot?"
  342. or with timeout before first available action is taken:
  343. pxe-prompt="Press F8 for menu.", 60

  344. Available boot services. for PXE.
  345. pxe-service=x86PC, "Boot from local disk", 0

  346. Loads <tftp-root>/pxelinux.0 from dnsmasq TFTP server.
  347. pxe-service=x86PC, "Install Linux", pxelinux

  348. Loads <tftp-root>/pxelinux.0 from TFTP server at 1.2.3.4.
  349. Beware this fails on old PXE ROMS.
  350. pxe-service=x86PC, "Install Linux", pxelinux, 1.2.3.4

  351. Use bootserver on network, found my multicast or broadcast.
  352. pxe-service=x86PC, "Install windows from RIS server", 1

  353. Use bootserver at a known IP address.
  354. pxe-service=x86PC, "Install windows from RIS server", 1, 1.2.3.4

  355. If you have multicast-FTP available,
  356. information for that can be passed in a similar way using options 1
  357. to 5. See page 19 of
  358. http://download.intel.com/design/archives/wfm/downloads/pxespec.pdf

  359. Enable dnsmasq's built-in TFTP server
  360. enable-tftp

  361. Set the root directory for files availble via FTP.
  362. tftp-root=/var/ftpd

  363. Make the TFTP server more secure: with this set, only files owned by
  364. the user dnsmasq is running as will be send over the net.
  365. tftp-secure

  366. Set the boot file name only when the "red" tag is set.
  367. dhcp-boot=net:red,pxelinux.red-net

  368. An example of dhcp-boot with an external TFTP server: the name and IP
  369. address of the server are given after the filename.
  370. Can fail with old PXE ROMS. Overridden by --pxe-service.
  371. dhcp-boot=/var/ftpd/pxelinux.0,boothost,192.168.0.3

  372. Set the limit on DHCP leases, the default is 150
  373. 根据配置的subnet来配置这个值,这个就是dhcp分配的ip池
  374. dhcp-lease-max=150

  375. The DHCP server needs somewhere on disk to keep its lease database.
  376. This defaults to a sane location, but if you want to change it, use
  377. the line below.
  378. 查看dhcp的log
  379. dhcp-leasefile=/var/lib/dnsmasq/dnsmasq.leases

  380. Set the DHCP server to authoritative mode. In this mode it will barge in
  381. and take over the lease for any client which broadcasts on the network,
  382. whether it has a record of the lease or not. This avoids long timeouts
  383. when a machine wakes up on a new network. DO NOT enable this if there's
  384. the slighest chance that you might end up accidentally configuring a DHCP
  385. server for your campus/company accidentally. The ISC server uses
  386. the same option, and this URL provides more information:
  387. http://www.isc.org/index.pl?/sw/dhcp/authoritative.php
  388. dhcp-authoritative

  389. Run an executable when a DHCP lease is created or destroyed.
  390. The arguments sent to the script are "add" or "del",
  391. then the MAC address, the IP address and finally the hostname
  392. if there is one.
  393. dhcp-script=/bin/echo

  394. Set the cachesize here.
  395. 配置dns缓存池的大小,默认150,嘛设置个1000也无所谓
  396. cache-size=150

  397. If you want to disable negative caching, uncomment this.
  398. no-negcache

  399. Normally responses which come form /etc/hosts and the DHCP lease
  400. file have Time-To-Live set as zero, which conventionally means
  401. do not cache further. If you are happy to trade lower load on the
  402. server for potentially stale date, you can set a time-to-live (in
  403. seconds) here.
  404. local-ttl=

  405. If you want dnsmasq to detect attempts by Verisign to send queries
  406. to unregistered .com and .net hosts to its sitefinder service and
  407. have dnsmasq instead return the correct NXDOMAIN response, uncomment
  408. this line. You can add similar lines to do the same for other
  409. registries which have implemented wildcard A records.
  410. 防止dns污染,极端情况下,绑定nxdomain有助于帮助我们减少或者避免dns解析被污染。详情自行google查询。
  411. bogus-nxdomain=64.94.110.11

  412. If you want to fix up DNS results from upstream servers, use the
  413. alias option. This only works for IPv4.
  414. This alias makes a result of 1.2.3.4 appear as 5.6.7.8
  415. alias=1.2.3.4,5.6.7.8
  416. and this maps 1.2.3.x to 5.6.7.x
  417. alias=1.2.3.0,5.6.7.0,255.255.255.0
  418. and this maps 192.168.0.10->192.168.0.40 to 10.0.0.10->10.0.0.40
  419. alias=192.168.0.10-192.168.0.40,10.0.0.0,255.255.255.0

  420. Change these lines if you want dnsmasq to serve MX records.

  421. Return an MX record named "maildomain.com" with target
  422. servermachine.com and preference 50
  423. mx-host=maildomain.com,servermachine.com,50

  424. Set the default target for MX records created using the localmx option.
  425. mx-target=servermachine.com

  426. Return an MX record pointing to the mx-target for all local
  427. machines.
  428. localmx

  429. Return an MX record pointing to itself for all local machines.
  430. selfmx

  431. Change the following lines if you want dnsmasq to serve SRV
  432. records. These are useful if you want to serve ldap requests for
  433. Active Directory and other windows-originated DNS requests.
  434. See RFC 2782.
  435. You may add multiple srv-host lines.
  436. The fields are <name>,<target>,<port>,<priority>,<weight>
  437. If the domain part if missing from the name (so that is just has the
  438. service and protocol sections) then the domain given by the domain=
  439. config option is used. (Note that expand-hosts does not need to be
  440. set for this to work.)

  441. A SRV record sending LDAP for the example.com domain to
  442. ldapserver.example.com port 289
  443. srv-host=_ldap._tcp.example.com,ldapserver.example.com,389

  444. A SRV record sending LDAP for the example.com domain to
  445. ldapserver.example.com port 289 (using domain=)
  446. domain=example.com
  447. srv-host=_ldap._tcp,ldapserver.example.com,389

  448. Two SRV records for LDAP, each with different priorities
  449. srv-host=_ldap._tcp.example.com,ldapserver.example.com,389,1
  450. srv-host=_ldap._tcp.example.com,ldapserver.example.com,389,2

  451. A SRV record indicating that there is no LDAP server for the domain
  452. example.com
  453. srv-host=_ldap._tcp.example.com

  454. The following line shows how to make dnsmasq serve an arbitrary PTR
  455. record. This is useful for DNS-SD. (Note that the
  456. domain-name expansion done for SRV records _does_not
  457. occur for PTR records.)
  458. ptr-record=_http._tcp.dns-sd-services,"New Employee Page._http._tcp.dns-sd-services"

  459. Change the following lines to enable dnsmasq to serve TXT records.
  460. These are used for things like SPF and zeroconf. (Note that the
  461. domain-name expansion done for SRV records _does_not
  462. occur for TXT records.)

  463. Example SPF.
  464. txt-record=example.com,"v=spf1 a -all"

  465. Example zeroconf
  466. txt-record=_http._tcp.example.com,name=value,paper=A4

  467. Provide an alias for a "local" DNS name. Note that this only works
  468. for targets which are names from DHCP or /etc/hosts. Give host
  469. "bert" another name, bertrand
  470. cname=bertand,bert

  471. For debugging purposes, log each DNS query as it passes through
  472. dnsmasq.
  473. 打开dns 的log
  474. log-queries

  475. Log lots of extra information about DHCP transactions.
  476. 打开dhcp log
  477. log-dhcp

  478. Include a another lot of configuration options.
  479. conf-file=/etc/dnsmasq.more.conf
  480. conf-dir=/etc/dnsmasq.d


复制代码
声明本帖转自链接:http://www.jianshu.com/p/71ccc79aaa9e
作者:天堂未必在前方
來源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。


温馨提示

记得善用社区搜索功能,那里可能会有你想要的资源;论坛站内搜索

如果你有什么需要的资源可以去悬赏问答发帖,求助社区的网友,我们会在第一时间给你回复哦;资源求档

对于本社区如果你有任何好建议或者相关合作可以随时与我们联系,或者在反馈建议发帖,您的支持,是我们发展的最大动力;投诉建议

精彩评论20

玩躲猫猫. 发表于 2017-8-23 21:25 | 显示全部楼层
占位编辑

温馨提示

记得善用社区搜索功能,那里可能会有你想要的资源;论坛站内搜索

如果你有什么需要的资源可以去悬赏问答发帖,求助社区的网友,我们会在第一时间给你回复哦;资源求档

对于本社区如果你有任何好建议或者相关合作可以随时与我们联系,或者在反馈建议发帖,您的支持,是我们发展的最大动力;投诉建议

粉☆雪樱 发表于 2017-8-25 20:56 | 显示全部楼层
前排支持下

温馨提示

记得善用社区搜索功能,那里可能会有你想要的资源;论坛站内搜索

如果你有什么需要的资源可以去悬赏问答发帖,求助社区的网友,我们会在第一时间给你回复哦;资源求档

对于本社区如果你有任何好建议或者相关合作可以随时与我们联系,或者在反馈建议发帖,您的支持,是我们发展的最大动力;投诉建议

扰人心丶 发表于 2017-8-26 02:38 | 显示全部楼层
我是个凑数的。。。

温馨提示

记得善用社区搜索功能,那里可能会有你想要的资源;论坛站内搜索

如果你有什么需要的资源可以去悬赏问答发帖,求助社区的网友,我们会在第一时间给你回复哦;资源求档

对于本社区如果你有任何好建议或者相关合作可以随时与我们联系,或者在反馈建议发帖,您的支持,是我们发展的最大动力;投诉建议

小资情调 发表于 2017-8-26 06:35 | 显示全部楼层
支持支持再支持

温馨提示

记得善用社区搜索功能,那里可能会有你想要的资源;论坛站内搜索

如果你有什么需要的资源可以去悬赏问答发帖,求助社区的网友,我们会在第一时间给你回复哦;资源求档

对于本社区如果你有任何好建议或者相关合作可以随时与我们联系,或者在反馈建议发帖,您的支持,是我们发展的最大动力;投诉建议

叶陵 发表于 2017-8-26 10:08 | 显示全部楼层
前排支持下

温馨提示

记得善用社区搜索功能,那里可能会有你想要的资源;论坛站内搜索

如果你有什么需要的资源可以去悬赏问答发帖,求助社区的网友,我们会在第一时间给你回复哦;资源求档

对于本社区如果你有任何好建议或者相关合作可以随时与我们联系,或者在反馈建议发帖,您的支持,是我们发展的最大动力;投诉建议

雀桥相会 发表于 2017-8-26 13:54 | 显示全部楼层
顶顶更健康

温馨提示

记得善用社区搜索功能,那里可能会有你想要的资源;论坛站内搜索

如果你有什么需要的资源可以去悬赏问答发帖,求助社区的网友,我们会在第一时间给你回复哦;资源求档

对于本社区如果你有任何好建议或者相关合作可以随时与我们联系,或者在反馈建议发帖,您的支持,是我们发展的最大动力;投诉建议

纯色玫瑰• 发表于 2017-8-26 19:37 | 显示全部楼层
不错 支持一个了

温馨提示

记得善用社区搜索功能,那里可能会有你想要的资源;论坛站内搜索

如果你有什么需要的资源可以去悬赏问答发帖,求助社区的网友,我们会在第一时间给你回复哦;资源求档

对于本社区如果你有任何好建议或者相关合作可以随时与我们联系,或者在反馈建议发帖,您的支持,是我们发展的最大动力;投诉建议

牛嘿妹 发表于 2017-8-27 02:14 | 显示全部楼层
为了三千积分!

温馨提示

记得善用社区搜索功能,那里可能会有你想要的资源;论坛站内搜索

如果你有什么需要的资源可以去悬赏问答发帖,求助社区的网友,我们会在第一时间给你回复哦;资源求档

对于本社区如果你有任何好建议或者相关合作可以随时与我们联系,或者在反馈建议发帖,您的支持,是我们发展的最大动力;投诉建议

獨占heart- 发表于 2017-8-27 14:53 | 显示全部楼层
众里寻他千百度,蓦然回首在这里!

温馨提示

记得善用社区搜索功能,那里可能会有你想要的资源;论坛站内搜索

如果你有什么需要的资源可以去悬赏问答发帖,求助社区的网友,我们会在第一时间给你回复哦;资源求档

对于本社区如果你有任何好建议或者相关合作可以随时与我们联系,或者在反馈建议发帖,您的支持,是我们发展的最大动力;投诉建议

橙子焦糖 发表于 2017-8-27 19:43 | 显示全部楼层
顶顶更健康

温馨提示

记得善用社区搜索功能,那里可能会有你想要的资源;论坛站内搜索

如果你有什么需要的资源可以去悬赏问答发帖,求助社区的网友,我们会在第一时间给你回复哦;资源求档

对于本社区如果你有任何好建议或者相关合作可以随时与我们联系,或者在反馈建议发帖,您的支持,是我们发展的最大动力;投诉建议

本版积分规则
提醒:禁止复制他人回复等『恶意灌水』行为,违者重罚!

发表新帖
阅读排行更多+
快速回复 收藏帖子 返回列表
即刻加入,享受更多精彩。 会员登录[Login] 注册[Register]
资源分享,资源共享。
官方Facebok
Facebook.com/8ziyuan
意见反馈:[email protected]

关注我们的官方Twitter

Powered by Discuz! © 2016-2024 8ziyuan.com Inc. Protected by CloudFlare | 小黑屋 | 8资源分享论坛 | RSS订阅 | 手机版 | 联系我们