sammysideupp
Posts: 16
Joined: Sun Feb 05, 2017 6:53 pm

How to display the MAC / IP addresses

Tue Mar 28, 2017 2:20 pm

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.

User avatar
The Monkey
Posts: 25
Joined: Sun Mar 26, 2017 9:55 pm
Contact: Website

Re: How to display the MAC / IP addresses

Tue Mar 28, 2017 2:25 pm

I use an app or website called fing. I've used it for multiple projects.

jahboater
Posts: 4841
Joined: Wed Feb 04, 2015 6:38 pm

Re: How to display the MAC / IP addresses

Tue Mar 28, 2017 3:14 pm

On the Pi you can use nmap.

fred44nl
Posts: 292
Joined: Sat Jun 25, 2016 11:59 am
Location: Scharendijke, NL

Re: How to display the MAC / IP addresses

Tue Mar 28, 2017 4:28 pm

what's wrong with ifconfig :)
headless RPi 3B running from usbhdd.

Martin Frezman
Posts: 1020
Joined: Mon Oct 31, 2016 10:05 am

Re: How to display the MAC / IP addresses

Tue Mar 28, 2017 5:40 pm

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.
If this post appears in the wrong forums category, my apologies.

User avatar
elkberry
Posts: 167
Joined: Wed Dec 28, 2016 9:21 pm

Re: How to display the MAC / IP addresses

Thu Mar 30, 2017 5:28 am

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
From ZX81 to Raspberry Pi, but wait ... where's the 7805 gone?

gdt
Posts: 85
Joined: Thu Jul 19, 2012 10:19 am

Re: How to display the MAC / IP addresses

Thu Mar 30, 2017 11:23 am

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.

User avatar
elkberry
Posts: 167
Joined: Wed Dec 28, 2016 9:21 pm

Re: How to display the MAC / IP addresses

Thu Mar 30, 2017 7:19 pm

Bah, /64 subnets are soo ... standard.
From ZX81 to Raspberry Pi, but wait ... where's the 7805 gone?

User avatar
bensimmo
Posts: 4187
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: How to display the MAC / IP addresses

Thu Mar 30, 2017 7:59 pm

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/

Return to “Networking and servers”