OpenWRT 获取在线设备信息

一、通过DHCP client分配列表

root@OpenWrt:/# cat /tmp/dhcp.leases
946732871 f0:43:47:1a:xx:xx 192.168.88.196 Honor_8 01:f0:43:47:1a:bc:xx
946742704 08:10:7a:51:xx:xx 192.168.88.184 STAR10005760 01:08:10:7a:51:85:xx

可以获取到hostname mac ip

二、获取在线状态

root@OpenWrt:/# cat /proc/net/arp

IP address HW type Flags HW address Mask Device
192.168.0.1 0x1 0x2 b0:95:8e:5c:c9:79 * eth0.2
192.168.1.242 0x1 0x2 98:6c:f5:77:4f:40 * br-lan
192.168.0.124 0x1 0x0 00:00:00:00:00:00 * eth0.2
192.168.1.198 0x1 0x2 40:8d:5c:5a:a0:3c * br-lan

Flags标志可以表示是否在线状态,标志0x0表示不在线,离线,标志0X2表示在线

三、查看mac地址,IP,设备名等信息

root@OpenWrt:/# cat /tmp/dhcp.leases

1505227895 98:6c:f5:77:4f:40 192.168.1.242 android-5734b930181b5156 *
1505225907 40:8d:5c:5a:a0:3c 192.168.1.198 DESKTOP-AFGM9OL 01:40:8d:5c:5a:a0:3c

 

 

点赞