0

I have two RPis that I'd eventually like to use for different things. I want to be able to use them both headlessly but I don't ever plan on having them plugged into my laptop at the same time when I do this.

I've only ever worked with them headlessly so far and they're connected to my laptop running OS X via an Ethernet cord. When setting up my RPis initially I messed up with the the static IP setting for the Ethernet and could not figure out the IP address of the RPi to login. I ended up editing the cmdline.txt file to include ip=x.x.x.x which finally allowed me to login to my first RPi.

My question: Could I do the same thing with the second Pi - assign it the exact same IP - so I don't have to keep changing the IP address for that connection on my Mac since I'm configuring my DHCP with a manual address?

Again, I'm not planning having them plugged into the laptop at the same time (cannot even if I wanted because of only one Ethernet slot) which I thought might make it okay. But if there are hidden problems I - as a total amateur here - am missing I'd appreciate being told so I don't mess up anything else.

  • You could, but why not give them two different IP addresses in case you want to plug them in both at once later? (with an Ethernet switch) – immibis Dec 1 '16 at 5:01
0

If you are using SSH to access these Raspberry Pi's, and both Raspberry Pi's are using different installs of Raspbian, then you will see something like this (this is the output on Mac, unsure about other systems):

ssh pi@169.254.67.153
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:RANDOMKEY.
Please contact your system administrator.
Add correct host key in /Users/michaelbuerger/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/michaelbuerger/.ssh/known_hosts:1
ECDSA host key for 169.254.67.153 has changed and you have requested strict checking.
Host key verification failed.
make: *** [ssh] Error 255

This means every time you would like to SSH to the Pi, you would need to regenerate the key.

--Edit--

I have just learned that you are using OSX so here is some extra information:

To regenerate this key use ssh-keygen -R 169.254.67.153 (change IP, this works in my case)

Now, if you want to avoid regenerating this key, you can just copy the install of Raspbian over to the other Pi's SD card and you will be all set. This is the easy solution in my opinion.
If you want to change it on the current install. Check this out: Changing SSH host keys on Raspbian

  • "To regenerate this key use ssh-keygen -R 169.254.67.153" is rubbish! 169.254.67.153 is a Link-local address. – Milliways Dec 1 '16 at 5:16
  • @Milliways That IP is just specific to me, stated here: "(change IP, this works in my case)" – Michael Buerger Dec 1 '16 at 15:28
  • The point is link-local addresses are generated and not guaranteed to be persistent (although most seem to be derived algorithmically) . It makes no sense trying to use for persistent data. – Milliways Dec 1 '16 at 21:53
  • @Milliways Take a look at his question, he has set a static IP. My answer uses my static IP. Even if someone doesn't set a static IP, they should be able to understand it must be changed. What are you on about? – Michael Buerger Dec 2 '16 at 2:55
  • Thanks for the comment about the Raspbian versions. For the time being it looks like using the same version may be the easiest option for me. At this point it's all a matter of convenience as I want to be able to swap them out and run them headlessly with the least amount of fuss, and I can still have the option to change IPs if my needs change later. Thanks! – chainhomelow Dec 3 '16 at 0:03
0

If you are setting IP address that way you are making things hard for yourself, but YES you could do it.

IP addresses are NOT expensive, see how to set it up properly in:- How do I set up networking/WiFi/Static IP

Why do you have to change anything on the Mac? If setup properly you can plug in any IP address in the range. The link above suggests better ways of connecting.

PS I still don't understand WHY people want to assign static addresses - it seems to be some kind of Pi disease.

  • Thank you for the link. I'm not a networker and this is all honestly set up this way for ease of swapping out Pis without having to change anything but your link has given me a lot to think about and likely has an- ultimately - better way. This will be a good lesson in networking for me. I appreciate the resource. – chainhomelow Dec 3 '16 at 0:07

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.