![]() ![]() Grep -v 'mac.local #DYN' /etc/hosts > /etc/hosts.new Of course it'll allocate it too as a side effect. With outside help you can do the lookup on the DHCP server this DHCP client for example lets you query any MAC want. NOTE: this works even if they ignore PING packets because they can't ignore the ARP requests that are sent out first. There is even a special command for this arp-scan -localnet which forgets to do the PING. If you try to ping every (local) IP address your arp table arp -a will include all the MAC addresses and their assigned IPs. OTOH, if you really do want the IP address assigned to a particular MAC address the best you're going to do without outside help is to scan the subnet. ![]() ![]() everything is assigned an IP with dhcp but that IP never changes. That way you have the best of both worlds. The only way I've found to get around this is to make your DHCP server always assign a specific IP address to every device you have. ![]() Instead it makes the assumption that are aren't enough IP addresses available and preferentially reuses addresses. But it never uses this information to keep the same devices on stable IP addresses. This program records the Ethernet address of every device it has ever seen and the IP address that it assigned to it. Well, you're out of luck unless you can have the client volunteer that information and transmit via other means.I think you're running into what I believe is a serious mis-feature of the isc-dhcp server. #look for the output line describing our IP address #run the external command, break output into lines So, if you are building some kind of LAN based system and your clients are on the same ethernet segment, then you could get the MAC address by parsing the output of arp -n (linux) or arp -a (windows).Įdit: you ask in comments how to get the output of an external command - one way is to use backticks, e.g. The client MAC address will not be available to you except in one special circumstance: if the client is on the same ethernet segment as the server. You can get the client IP from $_SERVER Client MAC address Server MAC addressįor the MAC address, you could parse the output of netstat -ie in Linux, or ipconfig /all in Windows. You can get the server IP address from $_SERVER. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |