Page 1 of 1

How to display the MAC / IP addresses

Posted: Tue Mar 28, 2017 2:20 pm
by sammysideupp
I am currently working on a project. Is there a way to display the MAC or IP addresses of the devices (smartphones) connected on my RPi 3 Model B used as a hotspot on the browser of the Raspberry Pi? Thanks.

Re: How to display the MAC / IP addresses

Posted: Tue Mar 28, 2017 2:25 pm
by The Monkey
I use an app or website called fing. I've used it for multiple projects.

Re: How to display the MAC / IP addresses

Posted: Tue Mar 28, 2017 3:14 pm
by jahboater
On the Pi you can use nmap.

Re: How to display the MAC / IP addresses

Posted: Tue Mar 28, 2017 4:28 pm
by fred44nl
what's wrong with ifconfig :)

Re: How to display the MAC / IP addresses

Posted: Tue Mar 28, 2017 5:40 pm
by Martin Frezman
fred44nl wrote:what's wrong with ifconfig :)
Nothing wrong with it - it is a nice command and I use it frequently.
Although, some people say that ifconfig is obsoleted by 'ip'.

But it doesn't answer OP's question, which some may see as a problem.

I think the command the OP seeks is "arp", which dumps out a list of the devices "connected" to the machine upon which arp is run.

Re: How to display the MAC / IP addresses

Posted: Thu Mar 30, 2017 5:28 am
by elkberry
Martin Frezman wrote:
fred44nl wrote:what's wrong with ifconfig :)
Nothing wrong with it - it is a nice command and I use it frequently.
Although, some people say that ifconfig is obsoleted by 'ip'.

But it doesn't answer OP's question, which some may see as a problem.

I think the command the OP seeks is "arp", which dumps out a list of the devices "connected" to the machine upon which arp is run.
Oh sweet irony, the ip command also shows the contents of the neighbor caches, such as for ARP and ND. :D However, this shows the active stations only, as these caches are the layer 3 (!) view. This is not necessary covering all associated clients. But this might help: viewtopic.php?f=29&t=109060

Re: How to display the MAC / IP addresses

Posted: Thu Mar 30, 2017 11:23 am
by gdt
You can display the ethernet addresses of machines which connect to your from the same subnet your RPi is on. Use the "arp" command, the "ip neigh show" command, or display the file /proc/net/arp. For IPv6 try "ip -6 neigh show". All these options list the "neighbour cache", which we used to call the "ARP cache" when there was only IPv4. Note carefully that this is a cache: entries stay in the table only whilst they are being used, there are incomplete entries awaiting a response from the neighbour, and unused entries are expired from the cache.

Machines from another subnet do not appear in the neighbour cache. Those off-subnet machines are reached by sending off-subnet traffic via an IP router, so its is that router's IP address and ethernet address which are needed in the neighbour cache.

In a modern network there should be no way to discover all the machines within your subnet short of trying each possibility. For IPv4 you could send a unicast probe to each potential IPv4 address in the subnet. "nmap" is one program which does this. You can do the same for IPv6, but you will be waiting some considerable time for it to finish trying all 2^64 possibilities :-)

Because many machines try to communicate off-subnet, the neighbour cache on the router is commonly the most interesting.

Edit: for your particular problem, you could consider using 802.11x authentication instead of a wireless hotspot landing page. The protocol for that includes the neighbour address. If you are using access points then the MAC address appears in the Calling-Station of the authentication request.

Re: How to display the MAC / IP addresses

Posted: Thu Mar 30, 2017 7:19 pm
by elkberry
Bah, /64 subnets are soo ... standard.

Re: How to display the MAC / IP addresses

Posted: Thu Mar 30, 2017 7:59 pm
by bensimmo
Lots of options of course, but do try the mentioned Fing.
It's nice under Android, works well under Windows too and has a RaspberryPi download too.
You don't actually need a login, that's a recent thing for seeing things online and syncronising names and lists etc.
https://www.fing.io/download-free-ip-sc ... s-and-osx/