LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   how to make a log of each ip and mac address (https://www.linuxquestions.org/questions/linux-networking-3/how-to-make-a-log-of-each-ip-and-mac-address-703720/)

atomic.rabbit 02-10-2009 05:22 PM

how to make a log of each ip and mac address
 
Hello

I have a machine acting as a router. How can I make a log of each ip and it's respective mac address that accesses the router? I need to compile a list over several days, so to be sure that I have logged almost every mac.

I have outputted to a text file the result of "arp -n" but at any given moment I only see a fraction of the total macs in the lan, so this is not enough.

Thank you!
vlad

j-osh 02-10-2009 05:51 PM

What if you collect a trace using wireshark/tshark and once you feel you collected enough packets write yourself a script using libpcap to parse through the trace and collect out the mac addresses? Might be more work than you want to do but would get the job done.

atomic.rabbit 02-10-2009 06:00 PM

That would not be suitable to my situation. I have around 400 clients accessing that router, and they generate around 200mbs of traffic at any given moment. A capture with wireshark would generate an enormous amount of data.

Would it be possible to arping the entire ip class at given intervals, and as it gets responses to log them in a file?

j-osh 02-10-2009 06:43 PM

You can always truncate the trace to only collect headers. I also just took a look at arping and see no reason why that wouldn't work as long as you know the IP's/dns_names of your clients. Collecting traces is usually the passive data collection approach when you are not able to actively collect the information but if you are able to send ARP request to each client then that is the way to go since ARP was made for that. It's just that usually if you are sitting at a router and want to probe every possible client that can send traffic through you (such as an ISP) the is no bound to the number of ARP requests you would have to send.

nx5000 02-10-2009 07:13 PM

arpwatch might be what your looking for.

farslayer 02-11-2009 08:36 AM

you could force the arping by doing a scan of the network with nmap....

arpwatch looks like a great suggestion..

anomie 02-11-2009 12:12 PM

Right, I also use arpwatch for this purpose. No need to reinvent the wheel.

arpwatch keeps a (plaintext) MAC address / IP address / hostname db, and it even reports significant events on the network - e.g. duplicate IP addresses, MAC to IP mapping changes, etc.

atomic.rabbit 02-12-2009 02:40 AM

arpwatch is a great solution. i used it and already collecting data. thank you for your help!


All times are GMT -5. The time now is 07:55 PM.