DD-WRT: Command-line to get DHCP-lease time not expired clients

This is an example of my Buffalo WHR-HP-G54 router (with DD-WRT installed) connected devices showing:

  • Active (transmitting) wireless clients.
  • Clients whose DHCP Lease Time has not expired (configured to 180 minutes in my case).

As I use to enter the device via SSH, I would like to develop some script to obtain the second table: DHCP Clients List. All I can do for now is just:

~# ssh root@192.168.8.202 -p 1022
root@192.168.8.202's password:
==========================================================

 ____  ___    __        ______ _____         ____  _  _
 | _ \| _ \   \ \      / /  _ \_   _| __   _|___ \| || |
 || | || ||____\ \ /\ / /| |_) || |   \ \ / / __) | || |_
 ||_| ||_||_____\ V  V / |  _ < | |    \ V / / __/|__   _|
 |___/|___/      \_/\_/  |_| \_\|_|     \_/ |_____|  |_|

                       DD-WRT v24
                   http://www.dd-wrt.com

==========================================================


BusyBox v1.4.2 (2007-08-15 14:58:26 CEST) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

~ # arp -a
? (192.168.11.104) at 78:40:E4:E6:4B:1C [ether] on br0
? (192.168.11.121) at 64:9A:BE:56:EC:7F [ether] on br0
? (192.168.11.126) at <incomplete> on br0
? (192.168.11.110) at 40:B3:95:F2:3A:1A [ether] on br0
? (192.168.11.112) at F0:25:B7:38:00:81 [ether] on br0
? (192.168.11.108) at <incomplete> on br0
? (192.168.8.1) at 00:24:A5:C7:DD:BC [ether] on vlan1
? (192.168.11.103) at F0:24:75:52:0B:27 [ether] on br0
? (192.168.11.125) at 04:4B:ED:6B:8E:73 [ether] on br0
? (192.168.11.125) at 04:4B:ED:6B:8E:73 [ether] on br0
~ # more /proc/net/arp
IP address       HW type     Flags       HW address            Mask     Device
192.168.11.104   0x1         0x2         78:40:E4:E6:4B:1C     *        br0
192.168.11.121   0x1         0x2         64:9A:BE:56:EC:7F     *        br0
192.168.11.126   0x1         0x0         60:AF:6D:48:5E:E5     *        br0
192.168.11.110   0x1         0x2         40:B3:95:F2:3A:1A     *        br0
192.168.11.112   0x1         0x2         F0:25:B7:38:00:81     *        br0
192.168.11.108   0x1         0x0         58:7F:57:DB:BE:15     *        br0
192.168.8.1      0x1         0x2         00:24:A5:C7:DD:BC     *        vlan1
192.168.11.103   0x1         0x2         F0:24:75:52:0B:27     *        br0
192.168.11.127   0x1         0x2         48:5A:3F:47:3A:7C     *        br0
192.168.11.125   0x1         0x2         04:4B:ED:6B:8E:73     *        br0

But the ARP list for the router is not the same thing. I have researched over here:

~ # ls /proc/net/ -la
dr-xr-xr-x    6 root     root            0 Dec  3 19:29 .
dr-xr-xr-x   34 root     root            0 Jan  1  2000 ..
-r--r--r--    1 root     root            0 Dec  3 19:29 arp
-r--r--r--    1 root     root            0 Dec  3 19:29 dev
-r--r--r--    1 root     root            0 Dec  3 19:29 dev_mcast
dr-xr-xr-x    2 root     root            0 Dec  3 19:29 drivers
-r--r--r--    1 root     root            0 Dec  3 19:29 igmp
-r--r-----    1 root     root            0 Dec  3 19:29 ip_conntrack
-r--r--r--    1 root     root            0 Dec  3 19:29 ip_mr_cache
-r--r--r--    1 root     root            0 Dec  3 19:29 ip_mr_vif
-r--r--r--    1 root     root            0 Dec  3 19:29 ip_tables_matches
-r--r--r--    1 root     root            0 Dec  3 19:29 ip_tables_names
-r--r--r--    1 root     root            0 Dec  3 19:29 ip_tables_targets
dr-xr-xr-x    2 root     root            0 Dec  3 19:29 ipt_recent
-rw-r--r--    1 root     root            0 Dec  3 19:29 layer7_numpackets
-r--r--r--    1 root     root            0 Dec  3 19:29 mcfilter
-r--r--r--    1 root     root            0 Dec  3 19:29 netlink
-r--r--r--    1 root     root            0 Dec  3 19:29 netstat
-r--r--r--    1 root     root            0 Dec  3 19:29 packet
-r--r--r--    1 root     root            0 Dec  3 19:29 pppoe
-r--r--r--    1 root     root            0 Dec  3 19:29 psched
-r--r--r--    1 root     root            0 Dec  3 19:29 raw
-r--r--r--    1 root     root            0 Dec  3 19:29 route
-r--r--r--    1 root     root            0 Dec  3 19:29 rt_cache
-r--r--r--    1 root     root            0 Dec  3 19:29 snmp
-r--r--r--    1 root     root            0 Dec  3 19:29 sockstat
-r--r--r--    1 root     root            0 Dec  3 19:29 softnet_stat
dr-xr-xr-x    2 root     root            0 Dec  3 19:29 stat
-r--r--r--    1 root     root            0 Dec  3 19:29 tcp
-r--r--r--    1 root     root            0 Dec  3 19:29 udp
-r--r--r--    1 root     root            0 Dec  3 19:29 unix
dr-xr-xr-x    2 root     root            0 Dec  3 19:29 vlan
-r--r--r--    1 root     root            0 Dec  3 19:29 wireless
-r--r--r--    1 root     root            0 Dec  3 19:29 wl0

But I have not been able to know if some of these files contain my data.

Is there any way to obtain this via command-line? Maybe some generic Linux method for DHCP Lease Not Expired Clients would work, but I don't know of any.

Answers


As long as DD-WRT uses udhcpd to handle its DHCP Service, the actual DHCP lease can be found at /tmp having a rather obvious name, like:

/tmp/udhcpd.leases
/tmp/dnsmasq.leases

Tested working on Buffalo WHR-HP-GN and WHR-HP-G54 running DD-WRT.

(Thanks you, @ChrisN)


Need Your Help

CSRF verification failed. Request aborted. in Facebook canvas

django facebook heroku csrf django-csrf

Ok, so as you can see I have a Django app going on using csrf. It all works perfectly but, now I want my app to be shown in a iframe (Facebook canvas).

Play youtube on ShockWaveFlash

flash delphi parameters activex

where can i get other parameter needed to autoplay and select preferred resolution like 240p as default on playing youtube videos using ShockWaveFlash in delphi?