This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Is there any way that I can get DHCP table?
#9
You can get a list table with IP -> MAC mapping from the ARP table like this:
Code:
macs = {}
lines = io.readfile('/proc/net/arp'):split('\n')

-- skip first and last line
for i = 2, #lines - 1 do
  ip, _, _, mac = unpack(lines[ i ]:gsub('%s+', ' '):split(' '))
  macs[ ip ] = mac
end

log(macs)

Name is a part of DHCP and only the DHCP server / router has this information.
Reply


Messages In This Thread
RE: Is there any way that I can get DHCP table? - by admin - 11.01.2021, 08:03

Forum Jump: