title: DD-WRT: Command-line to get DHCP-lease time not expired clients
body: <p>This is an example of my Buffalo WHR-HP-G54 router (with <strong>DD-WRT</strong> installed) <strong>connected devices</strong> showing:</p>
  
  <ul>
  <li>Active (transmitting) wireless clients.</li>
  <li>Clients whose DHCP Lease Time has not expired (configured to 180 minutes in my case).</li>
  </ul>
  
  <p><a href="https://i.stack.imgur.com/wE2Ot.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wE2Ot.png" alt="IMAGE"></a></p>
  
  <p>As I use to enter the device via SSH, I would like to develop some <strong>script</strong> to obtain the second table: <strong>DHCP Clients List</strong>.<br>
  All I can do for now is just:</p>
  
  <pre><code>~# ssh root@192.168.8.202 -p 1022
  root@192.168.8.202's password:
  ==========================================================
  
   ____  ___    __        ______ _____         ____  _  _
   | _ \| _ \   \ \      / /  _ \_   _| __   _|___ \| || |
   || | || ||____\ \ /\ / /| |_) || |   \ \ / / __) | || |_
   ||_| ||_||_____\ V  V / |  _ &lt; | |    \ 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 &lt;incomplete&gt; 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 &lt;incomplete&gt; 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
  </code></pre>
  
  <p>But the ARP list for the router is not the same thing.<br>
  I have researched over here:</p>
  
  <pre><code>~ # 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
  </code></pre>
  
  <p>But I have not been able to know if some of these files contain my data.  </p>
  
  <p>Is there any way to <strong>obtain this via command-line</strong>?<br>
  Maybe some generic Linux method for <strong>DHCP Lease Not Expired Clients</strong> would work, but I don't know of any.</p>