4

Disclaimer: new to Linux, using Raspbian Light on a Pi 3. SSH access only.

I'm trying to look for the mac address using ping / arp:

ping 192.168.1.7
arp 192.168.1.7

It returns:

Address                  HWtype  HWaddress           Flags Mask            Iface
192.168.1.7              ether   02:0f:b5:ed:9e:5c   C                     eth0

The HWaddress is different from the mac address I see in Windows:

ping 192.168.1.7
arp -a 192.168.1.7

This results in:

Internet Address      Physical Address      Type
192.168.1.7           c0-ee-fb-ed-9e-5c     dynamic

Network topology

Pi on cable (.27) → switch on cable → router (.1)
Phone on wifi (.7) → router (.1)
Windows on wifi (.30) → router (.1)

How can I get my Pi to return the same Mac?

Note: looks like the 'vendor' part is different. So it's 'almost' right?

  • To clarify: 192.168.1.7 is a machine different from your RaspPi and your Windows PC, and you are obtaining the MAC address at the same time, with all three machines connected to a network, so it can't be the case that 192.168.1.7 is assigned to different computers? – dirkt Apr 11 '17 at 8:25
  • 1
    I've added the network topology. All devices have different IP's. It looks like my Android phone and Windows have the 'correct' MACs. If I put the macs trough the mac-vendor.com API the correct vendors are shown. The macs discovered by the pi are not correct according to the mac-vendor API. – Kees C. Bakker Apr 11 '17 at 9:41
3

Best guess: Your RaspPi is connected to the router via LAN, while the "target" phone and the Windows PC are connected via WLAN. That means while the phone and the Windows PC are in the same segment and ARP works as intended, normally the LAN and the WLAN wouldn't be in the same segment.

Since they seem to be in the same segment (same /24 prefix), I'd assume the router does some fancy things to make that work, like MAC NAT via ebtables. The fact that the "spoofed" MAC address only differs in vendor prefix, and the vendor prefix doesn't seem to be valid, also points to this.

You can test this by connecting your Windows PC to the router via LAN (cable), and see which MAC address it reports in that case.

Another way to test it is to get root access to your router, and have a look at what's happening inside.

Edit

If this guess is correct, it's purely a router issue, not an issue of Linux vs. Windows. Windows will also find the "wrong" MAC address if the Windows PC is connected via LAN, while the target phone is connected via WLAN. Every device that is connected via WLAN will see the "wrong" MAC address of every device that is connected via LAN, and vice versa.

And you can't "work around" it, unless you can configure your router to disable it. In that case you'll have probably different subnets for LAN and WLAN, and the RaspPi in the LAN won't see the MAC of any device in the WLAN at all (and vice versa), though they can communicate with each other.

That's just how networking works.

The question is: Why do you need the "correct" MAC address in the first place? You shouldn't need to.

  • Is there a way to work around it? My router uses the same IP range through out (wifi+cable). How come Windows can find the rest of the right mac-addresses that are on cables? – Kees C. Bakker Apr 11 '17 at 10:08
1

The arp command will give you the right mac adress of the rpi network interface and you can verify it as follow:

ssh pi@192.168.1.7
sudo cat /sys/class/net/eth0/address

The c0-ee-fb-ed-9e-5c is the mac adress of your One Plus phone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.