1
exkernel 2017-08-25 07:49:56 +08:00 via iPhone
|
2
station OP |
3
xfspace 2017-08-25 08:59:11 +08:00 via Android
# If you want dnsmasq to listen for DHCP and DNS requests only on
# specified interfaces (and the loopback) give the name of the # interface (eg eth0) here. # Repeat the line for more than one interface. #interface= # Or you can specify which interface _not_ to listen on #except-interface= # Or which to listen on by address (remember to include 127.0.0.1 if # you use this.) #listen-address= # If you want dnsmasq to provide only DNS service on an interface, # configure it as shown above, and then use the following line to # disable DHCP and TFTP on it. #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 都试试? |
4
predator 2017-08-25 09:02:31 +08:00
bind-interfaces
需要写多这一条 dhcp 租约需要加一句 log-dhcp 然后在输出日志上可以 tail 到详细的租约信息(最好注释掉 log-queries ) |
6
station OP |
7
predator 2017-08-25 09:21:32 +08:00
就两条配置就够了啊
log-dhcp log-facility=/var/log/dnsmasq.log 然后再上面指定的日志文件里面就可以拿到详尽的 dhcp 信息: Aug 25 09:16:51 dnsmasq-dhcp[6353]: 1819931555 available DHCP range: 192.168.1.201 -- 192.168.1.232 Aug 25 09:16:51 dnsmasq-dhcp[6353]: 1819931555 client provides name: iPhone Aug 25 09:16:51 dnsmasq-dhcp[6353]: 1819931555 DHCPREQUEST(eth0) 192.168.1.227 44:00:10:a3:87:da Aug 25 09:16:51 dnsmasq-dhcp[6353]: 1819931555 tags: eth0 Aug 25 09:16:51 dnsmasq-dhcp[6353]: 1819931555 DHCPACK(eth0) 192.168.1.227 44:00:10:a3:87:da iPhone Aug 25 09:16:51 dnsmasq-dhcp[6353]: 1819931555 requested options: 1:netmask, 121:classless-static-route, 3:router, Aug 25 09:16:51 dnsmasq-dhcp[6353]: 1819931555 requested options: 6:dns-server, 15:domain-name, 119:domain-search, Aug 25 09:16:51 dnsmasq-dhcp[6353]: 1819931555 requested options: 252 Aug 25 09:16:51 dnsmasq-dhcp[6353]: 1819931555 next server: 192.168.1.1 Aug 25 09:16:51 dnsmasq-dhcp[6353]: 1819931555 sent size: 1 option: 53 message-type 5 Aug 25 09:16:51 dnsmasq-dhcp[6353]: 1819931555 sent size: 4 option: 54 server-identifier 192.168.1.1 Aug 25 09:16:51 dnsmasq-dhcp[6353]: 1819931555 sent size: 4 option: 51 lease-time 2d Aug 25 09:16:51 dnsmasq-dhcp[6353]: 1819931555 sent size: 4 option: 58 T1 1d Aug 25 09:16:51 dnsmasq-dhcp[6353]: 1819931555 sent size: 4 option: 59 T2 1d18h Aug 25 09:16:51 dnsmasq-dhcp[6353]: 1819931555 sent size: 4 option: 1 netmask 255.255.255.0 Aug 25 09:16:51 dnsmasq-dhcp[6353]: 1819931555 sent size: 4 option: 28 broadcast 192.168.1.255 Aug 25 09:16:51 dnsmasq-dhcp[6353]: 1819931555 sent size: 4 option: 6 dns-server 192.168.1.1 Aug 25 09:16:51 dnsmasq-dhcp[6353]: 1819931555 sent size: 4 option: 3 router 192.168.1.1 |
8
predator 2017-08-25 09:25:30 +08:00
还有一个你可能用得上的是:
dhcp-leasefile=/var/log/dhcp.leases 这里可以记录到全部客户端的租约信息 |
9
jasontse 2017-08-25 09:25:41 +08:00 via Android
DHCP 要接收广播消息,怎么可以限定地址。
|
10
lazycat 2017-08-25 09:33:36 +08:00
DHCP 获取到地址之前客户端本身是没有 IP 地址的。。。先不说能不能限制如果你真做到了把 dnsmasq 限制监听 192.168.0.1 这个段后果就是新设备全部无法获取 IP 地址上不了网除非你手动分配一个这个网段的 IP,不过手动分配的话还要 DHCP 有什么用呢。。。
|
11
lybtongji 2017-08-25 15:49:59 +08:00
不如 mac 绑定吧
|