Which command I have to use to see the active DHCP clients from ssh console? This info is available in web UI. And one similar question: is there a way to see currently ssh connected users - something like "w" or "who" is Linux.
Date: 26 Jun 2012 12:51
Number of posts: 8
RSS: New posts
1. Use arp command
2. Re-compile yourself with that feature enabled in busybox
Some builds already have "arp", but the web gui uses "cat /proc/net/arp" which is same info nicely formatted - its also merges in a dhcp lease file for which I don't think there is a easy alternative. If you look elsewhere you can also find out what port a client is on and what speed that port is set to using an Oleg fork of Broadcoms robocfg.
it also merges in a dhcp lease file…
My recollection was that Dnsmasq is ran with an option not to store a lease file. (See this thread.)
You can get Dnsmasq to dump its cache:
When it receives a SIGUSR1, dnsmasq writes statistics to the system log. It writes the cache size, the number of names which have had to removed from the cache before they expired in order to make room for new names and the total number of names that have been inserted into the cache. For each upstream server it gives the number of queries sent, and the number which resulted in an error. In --no-daemon mode or when full logging is enabled (-q), a complete dump of the contents of the cache is made.
But getting the full list of names depends on the -q switch, which I'm sure isn't enabled, and it inconveniently writes the info to syslog.
I'd be curious to know if there was some other way of getting at the Dnsmasq lease info. (Aside from indirectly via the arp table.)
is there a way to see currently ssh connected users
This will give you a rudimentary indication:
# ps | fgrep dropbear 440 root 1156 S dropbear -p 22 -a 6672 root 1208 S dropbear -p 22 -a 6684 root 1208 S dropbear -p 22 -a
The low numbered process is the listening daemon that is always present. One additional child is spawned for each user logged in. So user count = dropbear count - 1. (The above illustrates two logins.)
About Tom Metro
killall -SIGUSR2 dnsmasq
A good thought. SIGUSR2 provokes Dnsmasq to close and reopen its output files. /var/tmp/dhcp/leases doesn't exist initially, but after sending the SIGUSR2 signal, it does, but it is empty.
My guess, given that the man page says for the —leasefile-ro option, "Completely suppress use of the lease database file. The file will not be created, read, or written." that it is a bug that a SIGUSR2 signal causes it to be created.
I posted a bug report to the Dnsmasq list. Simon's reply was that he wondered if this behavior was due to a Tomato-specific patch.
About Tom Metro