LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Get IP based on Mac address (https://www.linuxquestions.org/questions/linux-networking-3/get-ip-based-on-mac-address-140785/)

sunmiewon 01-31-2004 04:09 PM

Get IP based on Mac address
 
I'm on a small network using DHCP - so as machines connect there's no telling what the IP address will be. The machines connecting are both PC and Mac. The server is FreeBSD (don't know the version, but it's recent).

From the server, I'd like to be able to tell who is logged in and what IP address has been assigned to them. I can get the Mac address per machine to try to figure this out. Can I parse out the results of netstat somehow? Can I assume that the MAC address will always be the same per machine?

Thanks for the help!

david_ross 01-31-2004 04:18 PM

Welcome to LQ.

The MAC address is unique to each card. You should be able to find the IP address with:
arp -n

fur 01-31-2004 04:23 PM

On the FreeBSD computer issue this command,,

cat /var/db/dhcpd.leases

That file will show the IP that has been leased. To what MAC address it has been leased to, and the lease times.

chort 01-31-2004 04:29 PM

You want arping

Half_Elf 01-31-2004 06:18 PM

keep in mind that it is possible to FAKE a mac adress, especially in Linux :P
if you are a network admin that want to give an eye on users, keep in mind troublemaker could change their mac adress ;)

I did this sometime at university lol :D


All times are GMT -5. The time now is 01:25 AM.