User avatar
piglet
Posts: 877
Joined: Sat Aug 27, 2011 1:16 pm

Two Pi's, both on network with same IP address!

Fri Sep 28, 2012 10:22 am

I have two pi's - and they both get the same IP address. I can't have them on the network at the same time. I thought that DHCP made that impossible.

I only found out last night when powered up both, used the ip address from ifconfig on one and trying to sftp to it from one to the other ended up trashing the files completely:

ie.

1) Pi 1 was on - had the files
2) pi 2 then was booted up, I ran ifconfig to check the ip address
3) on pi 1 sftp [email protected]<addressForPi2>
4) put <files.*>

What then happened is that it rattled through all the files from pi1 and ended up with them all at zero bytes long on pi1; nothing on pi2.

ifconfig on pi1 showed the same ip address as showed on pi2.


I was thinking of looking to see if my router allowed static IP address by mac address to allocate specific, different addresses. Is there a better way?

User avatar
RaTTuS
Posts: 10109
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Two Pi's, both on network with same IP address!

Fri Sep 28, 2012 10:31 am

did you duplicate a working SD card to be used on both ?

does
cat /proc/cpuinfo
give different serial numbers for both
and cat /etc/hosts /etc/hostname
and yes

DHCP should not give out the same IP address but it can be confused if you force it
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: Two Pi's, both on network with same IP address!

Fri Sep 28, 2012 10:36 am

That's is pretty weird my router assigns IP addresses based on newly detected MAC addresses not on the number of active ethernet connections.

Do both PI's have different MAC addresses??

Richard S.

User avatar
RaTTuS
Posts: 10109
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Two Pi's, both on network with same IP address!

Fri Sep 28, 2012 10:41 am

redhawk wrote: Do both PI's have different MAC addresses??
Raspberry MAC address come from the serial number
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

bredman
Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm

Re: Two Pi's, both on network with same IP address!

Fri Sep 28, 2012 10:46 am

It might be useful to watch the DHCP negotiation in progress to see what is happening. Use the commands

sudo ifdown eth0
sudo ifup eth0

and you should see the DHCP server assigning the address. Use wlan0 if you have a WiFi connection.

Is there any chance that you have two DHCP servers active on the same network?

User avatar
malakai
Posts: 1382
Joined: Sat Sep 15, 2012 10:35 am
Contact: Website

Re: Two Pi's, both on network with same IP address!

Fri Sep 28, 2012 10:51 am

It could be your router when it sees both the mac and host name is ignoring the mac and going by the host name since it already has a lease with that name it gives the unexpired IP back to the second Pi are either pi's renamed from default build?
http://www.raspians.com - always looking for content feel free to ask to have it posted. Or sign up and message me to become a contributor to the site. Raspians is not affiliated with the Raspberry Pi Foundation. (RPi's + You = Raspians)

lintweaker
Posts: 33
Joined: Mon Jul 09, 2012 6:26 pm

Re: Two Pi's, both on network with same IP address!

Fri Sep 28, 2012 11:21 am

Maybe you can check if you still have a persistent-net rule in /etc/udev/rules.d? If so, just remove it for both Pi's.

User avatar
piglet
Posts: 877
Joined: Sat Aug 27, 2011 1:16 pm

Re: Two Pi's, both on network with same IP address!

Fri Sep 28, 2012 1:37 pm

Thanks all. I'll try those suggestions. Then again, I may not need to as I'll be probably be passing one to our local school and it may be some time till I get a replacement.

Return to “Troubleshooting”