[Dnsmasq-discuss] Bug (sort-of): New link for dhcp-authoritative at ISC

2010-12-20 Thread Bob Brown
The ISC has moved the explanation of an authoritative DHCP server, so 
the link in the sample configuration file is stale.  The explanation is 
now located here: https://www.isc.org/files/auth.html

Thanks much for dnsmasq!

[Dnsmasq-discuss] Can one produce a list of IP's assigned by DHCP

2010-12-20 Thread Bernard T. Higonnet

other than by perusing the log?

I am trying to research a situation in which it appears (sic) that 
dnsmasq assigns an address and then when asked if it exists answers it 
does not.


My newbie status means I could have any of this wrong...

TIA
Bernard Higonnet



Re: [Dnsmasq-discuss] Can one produce a list of IP's assigned by DHCP

2010-12-20 Thread Santiago Zarate
if im not mistaken, you can pass a SIGUSR1 signal to the dnsmasq
process... it should send what's inside to the log...

Check here: http://www.thekelleys.org.uk/dnsmasq/docs/setup.html
under

Other configuration details:

Sending SIGUSR1 (killall -10 dnsmasq) to the dnsmasq process will
cause to to write cache usage statisticss to the log, typically
/var/log/syslog or /var/log/messages.

2010/12/20 Bernard T. Higonnet bth...@higonnet.net

 other than by perusing the log?

 I am trying to research a situation in which it appears (sic) that
 dnsmasq assigns an address and then when asked if it exists answers it
 does not.

 My newbie status means I could have any of this wrong...

 TIA
 Bernard Higonnet

 ___
 Dnsmasq-discuss mailing list
 Dnsmasq-discuss@lists.thekelleys.org.uk
 http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss



--
Atentamente
Santiago Zarate
Consultoria de Software
  +(58) 416 911 3678
  santi...@zarate.net.ve

«Dar un nuevo paso, articular una nueva palabra, es lo que la gente mas teme.»
  - Fyodor Mikhaylovich Dostoyevsky



Re: [Dnsmasq-discuss] Can one produce a list of IP's assigned by DHCP

2010-12-20 Thread Justin McAteer
For all of my installations, the list of current leases is stored at:
/var/lib/misc/dnsmasq.leases

Thank You,
Justin McAteer





On Mon, Dec 20, 2010 at 3:59 PM, Santiago Zarate santi...@zarate.net.ve wrote:
 if im not mistaken, you can pass a SIGUSR1 signal to the dnsmasq
 process... it should send what's inside to the log...

 Check here: http://www.thekelleys.org.uk/dnsmasq/docs/setup.html
 under

 Other configuration details:

 Sending SIGUSR1 (killall -10 dnsmasq) to the dnsmasq process will
 cause to to write cache usage statisticss to the log, typically
 /var/log/syslog or /var/log/messages.

 2010/12/20 Bernard T. Higonnet bth...@higonnet.net

 other than by perusing the log?

 I am trying to research a situation in which it appears (sic) that
 dnsmasq assigns an address and then when asked if it exists answers it
 does not.

 My newbie status means I could have any of this wrong...

 TIA
 Bernard Higonnet

 ___
 Dnsmasq-discuss mailing list
 Dnsmasq-discuss@lists.thekelleys.org.uk
 http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss



 --
 Atentamente
 Santiago Zarate
 Consultoria de Software
   +(58) 416 911 3678
   santi...@zarate.net.ve

 «Dar un nuevo paso, articular una nueva palabra, es lo que la gente mas teme.»
   - Fyodor Mikhaylovich Dostoyevsky

 ___
 Dnsmasq-discuss mailing list
 Dnsmasq-discuss@lists.thekelleys.org.uk
 http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss




Re: [Dnsmasq-discuss] Can one produce a list of IP's assigned by DHCP

2010-12-20 Thread Thomas S Hatch
If you are interested I have a script that parses the configs, finds all the
hosts files being used and parsed the leases file then spits out a hosts
file format file of everything dnsmasq is resolving


On Mon, Dec 20, 2010 at 3:44 PM, Justin McAteer jus...@jmcateer.com wrote:

 For all of my installations, the list of current leases is stored at:
 /var/lib/misc/dnsmasq.leases

 Thank You,
 Justin McAteer





 On Mon, Dec 20, 2010 at 3:59 PM, Santiago Zarate santi...@zarate.net.ve
 wrote:
  if im not mistaken, you can pass a SIGUSR1 signal to the dnsmasq
  process... it should send what's inside to the log...
 
  Check here: http://www.thekelleys.org.uk/dnsmasq/docs/setup.html
  under
 
  Other configuration details:
 
  Sending SIGUSR1 (killall -10 dnsmasq) to the dnsmasq process will
  cause to to write cache usage statisticss to the log, typically
  /var/log/syslog or /var/log/messages.
 
  2010/12/20 Bernard T. Higonnet bth...@higonnet.net
 
  other than by perusing the log?
 
  I am trying to research a situation in which it appears (sic) that
  dnsmasq assigns an address and then when asked if it exists answers it
  does not.
 
  My newbie status means I could have any of this wrong...
 
  TIA
  Bernard Higonnet
 
  ___
  Dnsmasq-discuss mailing list
  Dnsmasq-discuss@lists.thekelleys.org.uk
  http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
 
 
 
  --
  Atentamente
  Santiago Zarate
  Consultoria de Software
+(58) 416 911 3678
santi...@zarate.net.ve
 
  «Dar un nuevo paso, articular una nueva palabra, es lo que la gente mas
 teme.»
- Fyodor Mikhaylovich Dostoyevsky
 
  ___
  Dnsmasq-discuss mailing list
  Dnsmasq-discuss@lists.thekelleys.org.uk
  http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
 

 ___
 Dnsmasq-discuss mailing list
 Dnsmasq-discuss@lists.thekelleys.org.uk
 http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss



Re: [Dnsmasq-discuss] Can one produce a list of IP's assigned by DHCP

2010-12-20 Thread Bernard T. Higonnet

Justin McAteer wrote:

For all of my installations, the list of current leases is stored at:
/var/lib/misc/dnsmasq.leases



Turns out that in my FreeBSD 8.1 installation, dnsmasq.leases can be 
found in /var/db/ and was exactly what I was looking for.


Thanks!!
Bernard Higonnet



Re: [Dnsmasq-discuss] Can one produce a list of IP's assigned by DHCP

2010-12-20 Thread Thomas S Hatch
Well, regardless, enjoy my script, we use it to make a hosts file that can
be distributed to other dnsmasq servers of for a kind of
replication technique. It does what we want it to, you may have to change
line 24 to point to the correct leases file

On Mon, Dec 20, 2010 at 5:14 PM, Bernard T. Higonnet bth...@higonnet.netwrote:

 Justin McAteer wrote:
  For all of my installations, the list of current leases is stored at:
  /var/lib/misc/dnsmasq.leases


 Turns out that in my FreeBSD 8.1 installation, dnsmasq.leases can be
 found in /var/db/ and was exactly what I was looking for.

 Thanks!!
 Bernard Higonnet

 ___
 Dnsmasq-discuss mailing list
 Dnsmasq-discuss@lists.thekelleys.org.uk
 http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss

#!/usr/bin/python2

import sys
import os
import subprocess
import optparse
import time

class DNSData(object):
'''
Dumps DNS Data into a hosts file.
'''
def __init__(self, opts):
self.opts = opts
self.ips = set()

def _get_hosts(self):
'''
Run the host command on all the addrs...
No, run nmap...
No, parse the leases file and then run host on all of the leases
'''
hosts = {}
leases_fn = '/var/lib/misc/dnsmasq.leases'
for line in open(leases_fn, 'r').readlines():
self.ips.add(line.split()[2])
for ip in self.ips:
h_cmd = ['host', ip]
out = subprocess.Popen(h_cmd,
stdout=subprocess.PIPE).communicate()[0]
if out.count('not found'):
self.ips.remove(ip)
continue
hosts[out.split()[-1][:-1]] = ip

return hosts

def _get_static(self):
'''
Parses the dnsmasq configuration and adds all static hosts files to the
exported hosts file
'''
static_lines = []
addn_hosts = []
dnsc = '/etc/dnsmasq.conf'
for line in open(dnsc, 'r').readlines():
if line.startswith('addn-hosts='):
addn_hosts.append(line.split('=')[1].strip())
for addn in addn_hosts:
if not os.path.isfile(addn):
continue
for line in open(addn, 'r').readlines():
if line.startswith('#'):
continue
static_lines.append(line)
return static_lines


def gen_file(self):
'''
Generates the string used in the hosts file
'''
hosts = self._get_hosts()
static = self._get_static()
hfile = ['## Begin Generated Hosts ##\n']
for host in hosts:
line = hosts[host] + '\t\t' + host
hfile.append(line + '\n')

hfile.append('#  Begin Static Hosts  #\n')

for host in static:
hfile.append(host)

hfile.append('#  End Static Hosts  #\n')
hfile.append('## End Generated Hosts ##\n')

return hfile

def save_hosts(self, hfile):
'''
Save the hosts file.
'''
if not os.path.isdir(os.path.dirname(self.opts['location'])):
os.makedirs(os.path.dirname(self.opts['location']))
open(self.opts['location'], 'w+').writelines(hfile)


def start_rsync(self):
'''
Start the rsync daemon
'''
c_path = '/var/tmp/host-sync.conf'
conf = ['[hosts]\n',
'path = ' + os.path.dirname(self.opts['location'])  + '\n'
'read only = yes\n']
open(c_path, 'w+').writelines(conf)
r_cmd = 'rsync --daemon --config=/var/tmp/host-sync.conf --port=9426'
subprocess.call(r_cmd, shell=True)

def run_daemon(self):
'''
Start dnsdump running as a daemon.. Ok, I don't have the pid fork stuff
in here, run this in the background!
'''
self.start_rsync()
while True:
self.save_hosts(data.gen_file())
time.sleep(600)


def datacenter():
'''
Returns the datacenter number
'''
d_cmd = ip a | grep 172 | grep brd | awk '{print $2}' | cut -d. -f2
return subprocess.Popen(d_cmd,
shell=True,
stdout=subprocess.PIPE).communicate()[0][0]

def detect_networks():
'''
Parse all of the dnsmasq configuration files
'''
dnsc = '/etc/dnsmasq.conf'
nets = set()
conf_files = set()
for line in open(dnsc, 'r').readlines():
if line.startswith('domain='):
dom = line.split(',')
if dom.__len__()  1:
nets.add(dom[1])
elif line.startswith('conf-dir='):
cdir = line.split('=')[1].strip()
if os.path.isdir(cdir):
for fn_ in os.listdir(cdir):
if fn_.endswith('.conf'):
conf_files.add(os.path.join(cdir, fn_))
for cfn in conf_files:
if not os.path.isfile(cfn):
continue
for line 

[Dnsmasq-discuss] dnsmasq has issued a lease, but doesn't seem to know about it!??

2010-12-20 Thread Bernard T. Higonnet

Hello,

I have a machine, Zazalight, which has requested and received a lease, 
as evidenced by the following line in dnsmasq.leases:


===

moto in the following is the machine running dnsmasq

moto# cat /var/db/dnsmasq.leases
1292919092 00:16:d3:3b:4f:15 192.168.3.76 Zazalight 01:00:16:d3:3b:4f:15

moto# host -v 192.168.3.76 moto
Trying 76.3.168.192.in-addr.arpa
Using domain server:
Name: moto
Address: 192.168.3.113#53
Aliases:

Host 76.3.168.192.in-addr.arpa. not found: 3(NXDOMAIN)
Received 43 bytes from 192.168.3.113#53 in 2 ms
===


I fear that I've done something wrong, forgotten some option, which is 
so simple it's beyond dumb.


Ready for the worst...

TIA
Bernard Higonnet