Simple DHCP log question

Post new topic   Reply to topic    DD-WRT Forum Index -> Ralink SoC based Hardware
Author Message
cabsandy
DD-WRT User


Joined: 03 Jan 2009
Posts: 88

PostPosted: Fri Jul 25, 2014 11:38    Post subject: Simple DHCP log question Reply with quote
Hi guys
Just setting up a simple router (DIR-615 D2) to see how many people connect to it on a daily basis, if I leave it open. Looking through some posts, my options are either DNSMasq or iptables logs. Only thing is, these logs dont seem to be persistent across reboots (I'm guessing this is because its in the /tmp dir?). How would I go about logging all DHCP/MAC requests to a simple "on-board" log file

thanks

cabs
Sponsor
BasCom
DD-WRT Guru


Joined: 29 Jul 2009
Posts: 1378
Location: Germany

PostPosted: Fri Jul 25, 2014 21:29    Post subject: Reply with quote
copy log with cron on a smbshare or use a remote syslog, that receives routers syslog instantly.
_________________
RT-N66U @ Build 25697M K3.10.63
TL-WR842ND v1 @ BS-build 23919 WDS AP
TL-WR841ND @ BS-build 23919 WDS Client
TL-WR841ND @ BS-build 23919 Client Bridge ( Routed )
cabsandy
DD-WRT User


Joined: 03 Jan 2009
Posts: 88

PostPosted: Sat Jul 26, 2014 9:32    Post subject: Reply with quote
BasCom wrote:
copy log with cron on a smbshare or use a remote syslog, that receives routers syslog instantly.


Cheers for the reply-I was going down this route with the DNSMasq leases file,and trying to copy the file to something like test1.txt works in the /tmp directory, but then gets scrapped when the device is rebooted/powered off. I tried to put the txt file in somewhere like the /opt or /etc dir but it appears the folder permissions dont allows this. The device will be standalone, with no access to any remote network so smb wont work Wink

I just need to find out somehow an internal directory I can write to away from the /tmp directory! Wink

cabs
BasCom
DD-WRT Guru


Joined: 29 Jul 2009
Posts: 1378
Location: Germany

PostPosted: Sat Jul 26, 2014 13:27    Post subject: Reply with quote
you could try jffs filesystem, but your device has a too small flash chip. sry, but without usb, smbshare or an remote syslog server ( you need a linux or windows machine ) its not possible. except you copy it manually every day
_________________
RT-N66U @ Build 25697M K3.10.63
TL-WR842ND v1 @ BS-build 23919 WDS AP
TL-WR841ND @ BS-build 23919 WDS Client
TL-WR841ND @ BS-build 23919 Client Bridge ( Routed )
cabsandy
DD-WRT User


Joined: 03 Jan 2009
Posts: 88

PostPosted: Tue Jul 29, 2014 7:49    Post subject: Reply with quote
Ok
So thanks for the replies-for anybody else who is looking for this, I have found a way to do it.Its a bit of a hack, and not perfect, but should do the trick.
I found if I went to Service tab, and ticked " Use NVRAM for client lease DB ", when the device is rebooted, the clients who have previously connected are still in the list which can be found at the Status/LAN/DHCP clients tab. See attached pic.

If you leave the NVRAM unticked, you lose the previous client list. So once you have your lists, simply cut and paste to notepad/Excel. It probably wont work if you have hundreds Shocked , but its a start, if your dealing with a router that has a small footprint of memory/no USB port/no remote connection.

The frustrating thing is, the .db is "in" NVRAM somewhere in the router, but when I telnet it, I cant find it to look at it (when I cd /nvram , it says it cant do it). If anybody knows how, please let me know-as DD-WRT says I'm only using 22k of 64k of NVRAM.

Hope this helps someone

cabs
BasCom
DD-WRT Guru


Joined: 29 Jul 2009
Posts: 1378
Location: Germany

PostPosted: Tue Jul 29, 2014 11:38    Post subject: Reply with quote
nvram is not in the filesystem, its a RW part of flash unit.
use in telnet: nvram show and it shows you alle the settings.
use nvram show | grep <<a known mac address>>

and it should show you the variable, where your leases are stored.

_________________
RT-N66U @ Build 25697M K3.10.63
TL-WR842ND v1 @ BS-build 23919 WDS AP
TL-WR841ND @ BS-build 23919 WDS Client
TL-WR841ND @ BS-build 23919 Client Bridge ( Routed )
cabsandy
DD-WRT User


Joined: 03 Jan 2009
Posts: 88

PostPosted: Tue Jul 29, 2014 14:00    Post subject: Reply with quote
BasCom wrote:
nvram is not in the filesystem, its a RW part of flash unit.
use in telnet: nvram show and it shows you alle the settings.
use nvram show | grep <<a known mac address>>

and it should show you the variable, where your leases are stored.


Ahh, top man-thanks Very Happy

Played about with it and nvram show | grep dnsmasq_lease_ seems to do it as well. Many thanks for the pointer and all the other help

cabs
BasCom
DD-WRT Guru


Joined: 29 Jul 2009
Posts: 1378
Location: Germany

PostPosted: Thu Aug 14, 2014 21:23    Post subject: Reply with quote
as i said some posts above with remote syslog. read the thread, dont just spam around since days.
_________________
RT-N66U @ Build 25697M K3.10.63
TL-WR842ND v1 @ BS-build 23919 WDS AP
TL-WR841ND @ BS-build 23919 WDS Client
TL-WR841ND @ BS-build 23919 Client Bridge ( Routed )
BasCom
DD-WRT Guru


Joined: 29 Jul 2009
Posts: 1378
Location: Germany

PostPosted: Fri Aug 15, 2014 7:42    Post subject: Reply with quote
jeah, as i said in post 2. remote syslog, lol you are most noob ever seen. roffel, go away from forum.
_________________
RT-N66U @ Build 25697M K3.10.63
TL-WR842ND v1 @ BS-build 23919 WDS AP
TL-WR841ND @ BS-build 23919 WDS Client
TL-WR841ND @ BS-build 23919 Client Bridge ( Routed )
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Ralink SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum