-1

I am using a raspberry pi to do various things. I installed OS 1 on my RPi a few weeks ago, established a hostname (I THINK), call it hostname1. I used a wifi adapter to connect to the internet for it (although possibly ethernet for initial setup).

I later decided I wanted to do something else, requiring a different OS, OS2. I also changed the hostname to hostname2 because I'm a child and wanted to call it "CutiePi" (aka hostname2). Now, the weird thing is that when I plug my Pi in with OS2 loaded and what I assume is hostname2, my router shows it as having hostname1. I also decided to change the MAC address in /etc/network/interfaces, and the router would show the original MAC address and hostname1.

Can anyone explain this behavior? Is there something that a router sees on a device that is independent of the OS installed that might be confusing it?

  • Try restarting the router, it might just have the hostname cached – Hydranix Feb 7 '17 at 2:04
  • Many router renember MAC/hostname associations, e.g. to give it the same local IP address via DHCP. Also, many routers allow to edit/delete these associations. Look closely at the web interface of your router. – dirkt Feb 7 '17 at 9:36
0

Try setting the mac address of the NIC with this command

ip link set address <MAC> <Device>

Example

ip link set address XX:XX:XX:XX:XX:XX eth0

To do this automatically whenever the interface is created (like at boot), create this file:

/etc/udev/rules.d/70-mac-address.rules

Contents:

Note that X is the original mac address and Y is the new address.

Note that /usr/bin/ip may not be the path to the ip binary on all systems. To know where you ip binry is located, use the command which ip and change the the following accordingly.

ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="XX:XX:XX:XX:XX:XX", RUN+="/usr/bin/ip link set dev %k address YY:YY:YY:YY:YY:YY"
  • Ah, that works! Any way to change MAC addresses at boot? or well, have it persist between reboots? – mr_penguin86 Feb 7 '17 at 3:10
  • A udev rule will be able to do that. I'll add it to answer. – Hydranix Feb 8 '17 at 21:58

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.