1

I want to know the best way to connect my RBP by wifi using the MAC Address. I currently use sudo nmap -sn 192.168.0.0/24 and obtain this

Nmap scan report for 192.168.0.114
Host is up (0.025s latency).
MAC Address: B8:27:EB:50:00:00 (Raspberry Pi Foundation)

and after that, I connected to the RBP by SHH ssh pi@192.168.0.114

the problem is that my internet connection is so unstable so, I have to repeat this a lot of times.

Is any way to connect directly by MAC?

Edit: Actually I am using Dataplicity for alternative third-party solutions.

Pedro Rout
  • 13
  • 4

2 Answers2

3

You can not connect by MAC - although you could use MAC to resolve IP.

You DO NOT need to know the IP address to connect to your Pi.
You can just connect to your server by name e.g. raspberrypi.local instead of IP address.
(NOTE raspberrypi is the default hostname, and can/should be changed).

You can easily connect from Linux and OS X with ssh pi@hostname.local (the default hostname is raspberrypi) This should work with popular GUI ssh programs. This is sometimes problematic with some versions of Windows and networks which use .local in a non-standard way. (See https://en.wikipedia.org/wiki/.local)

NOTE .local resolution does not always work e.g. in rsync. The following should resolve IP (and can be included in bash scripts)

RemotePi=$(getent hosts hostname.local | awk '{ print $1 }')

If you REALLY want to know the IP address you can discover it by many means;

arp raspberrypi.local on most networks (arp raspberrypi may work on some)

e.g.

arp archpi.local
archpi.local (10.1.1.20) -- no entry

or

getent hosts archpi.local | awk '{ print $1 }'
10.1.1.20

or

ping -c 1 archpi.local
PING archpi.local (10.1.1.20): 56 data bytes
64 bytes from 10.1.1.20: icmp_seq=0 ttl=64 time=4.607 ms
Milliways
  • 62,573
  • 32
  • 113
  • 225
1

If you want to use IP network connections, then there is no other way to address devices than with ip addresses. This is by design that can be described with the OSI model (Open Systems Interconnection model). Network connections are made on Layer 3: Network Layer using ip addresses. MAC addresses are used on the underlaying Layer 2: Data Link Layer to recover the ip address from the device by using the arp protocol. But it is not used for connections.

Ingo
  • 42,961
  • 20
  • 87
  • 207