bluestarfish
Posts: 7
Joined: Thu Jan 09, 2014 4:23 am

Connecting two Pi's via Ethernet

Mon Aug 10, 2015 11:09 am

Hi,

I have a project where two Pi's are connected via a standard (non-crossover) ethernet cable where one acts as a controller and the other as a logger. I am having trouble getting them to talk the more so by the fact that I don't have a monitor/keyboard (well HDMI monitor) and so am using SSH to configure them which I lose when I try the direct connection.

The set up I have on one is:

iface eth0 inet static
address 192.168.0.30
netmask 255.255.255.0

And on the other:

iface eth0 inet static
address 192.168.0.40
netmask 255.255.255.0

When they are connected to the wired network I can ssh to both of them and they can ping each other, when I connect them together they can't see each other so it has to be a routing issue. I have looked this up and there is conflicting advice as to the need for a gateway and just what other settings I need (IP tables??).

I am hoping someone can give me a quick pointer in the right direction, one of the Pi's has a GPS attached which I think gets in the way of a normal tty session so I seem to be going in circles sorting this out!

Many thanks,


Scott.

User avatar
joan
Posts: 14936
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Connecting two Pi's via Ethernet

Mon Aug 10, 2015 11:15 am

Is 192.168.0.x your PC's network? If so give the Pi's their own network such as 192.168.1.x
Last edited by joan on Mon Aug 10, 2015 11:21 am, edited 1 time in total.

bluestarfish
Posts: 7
Joined: Thu Jan 09, 2014 4:23 am

Re: Connecting two Pi's via Ethernet

Mon Aug 10, 2015 11:18 am

Hi,

yes my home network is 192.168.0.x - presume that by moving to another network such as 192.168.1.x that it looks for new routing info?? The reason that I am using the same network is that when they don't work I can put them back on the local network (i.e. into the router) without having to edit the interfaces file otherwise I can't reconnect with ssh which means I am locked out.

But will try this and see how I go - thanks :)


Scott.

fruitoftheloom
Posts: 23337
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Connecting two Pi's via Ethernet

Mon Aug 10, 2015 11:19 am

bluestarfish wrote:Hi,

I have a project where two Pi's are connected via a standard (non-crossover) ethernet cable where one acts as a controller and the other as a logger. I am having trouble getting them to talk the more so by the fact that I don't have a monitor/keyboard (well HDMI monitor) and so am using SSH to configure them which I lose when I try the direct connection.

The set up I have on one is:

iface eth0 inet static
address 192.168.0.30
netmask 255.255.255.0

And on the other:

iface eth0 inet static
address 192.168.0.40
netmask 255.255.255.0

When they are connected to the wired network I can ssh to both of them and they can ping each other, when I connect them together they can't see each other so it has to be a routing issue. I have looked this up and there is conflicting advice as to the need for a gateway and just what other settings I need (IP tables??).

I am hoping someone can give me a quick pointer in the right direction, one of the Pi's has a GPS attached which I think gets in the way of a normal tty session so I seem to be going in circles sorting this out!

Many thanks,


Scott.
The RPi have auto-sensing Ethernet Ports so immaterial what cable type used.

Using Direct Cable Connection one must be like a ""Master"" and the other ""Slave""

http://www.softprayog.in/troubleshootin ... -lan-cable
Rather than negativity think outside the box !
RPi 4B 4GB (SSD Boot)..
Asus ChromeBox 3 Celeron is my other computer...

drgeoff
Posts: 10765
Joined: Wed Jan 25, 2012 6:39 pm

Re: Connecting two Pi's via Ethernet

Mon Aug 10, 2015 12:39 pm

fruitoftheloom wrote:Using Direct Cable Connection one must be like a ""Master"" and the other ""Slave""
Nonsense. There is no requirement for master and slave.

fruitoftheloom
Posts: 23337
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Connecting two Pi's via Ethernet

Mon Aug 10, 2015 1:05 pm

drgeoff wrote:
fruitoftheloom wrote:Using Direct Cable Connection one must be like a ""Master"" and the other ""Slave""
Nonsense. There is no requirement for master and slave.
Jeez I said LIKE, have you nothing better to post :?:
Rather than negativity think outside the box !
RPi 4B 4GB (SSD Boot)..
Asus ChromeBox 3 Celeron is my other computer...

User avatar
rpdom
Posts: 17174
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Connecting two Pi's via Ethernet

Mon Aug 10, 2015 1:34 pm

fruitoftheloom wrote:
drgeoff wrote:
fruitoftheloom wrote:Using Direct Cable Connection one must be like a ""Master"" and the other ""Slave""
Nonsense. There is no requirement for master and slave.
Jeez I said LIKE, have you nothing better to post :?:
It's not even like... :roll:
They are both equal.

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Connecting two Pi's via Ethernet

Mon Aug 10, 2015 1:39 pm

I can't believe how clueless you guys are - that you can't see what Fruitie means.

(And this is a bit odd - for me to be supporting Fruitie)
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

fruitoftheloom
Posts: 23337
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Connecting two Pi's via Ethernet

Mon Aug 10, 2015 2:03 pm

Joe Schmoe wrote:I can't believe how clueless you guys are - that you can't see what Fruitie means.

(And this is a bit odd - for me to be supporting Fruitie)
Obviously my English Language Education at a UK State School was only the same as JS's, thanks JS :shock:
Rather than negativity think outside the box !
RPi 4B 4GB (SSD Boot)..
Asus ChromeBox 3 Celeron is my other computer...

User avatar
GerardWassink
Posts: 103
Joined: Sun Aug 02, 2015 5:57 pm
Location: Ulrum (Gr), Netherlands
Contact: Website

Re: Connecting two Pi's via Ethernet

Mon Aug 10, 2015 2:30 pm

More importantly: did it work now, Scot?

Another question would be: Why can they not be tested whilst being connected to your home network? You could then ssh-login to both of them to check what happens...

HTH,
Gerard
---------ooooO----- \\\\\|/// -----Oooo--------
Hacker on ELF-II, ZX80/1, Commodore 64, 8080, x86,
IBM 370 family mainframes
Machine code! Assembly! C good second.
Running Pi's with Hercules and S/370 OS's

-------------oooO-----------Oooo-------------

User avatar
DougieLawson
Posts: 39126
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Connecting two Pi's via Ethernet

Mon Aug 10, 2015 6:09 pm

When they are directly connected does one or the other have another active interface?

What does ifconfig -a and ip route show on both systems?

Whenever I want to do a direct point-to-point interface I'd use a completely different subnet (usually from 172.[16-31].xxx.xxx/16 but with a /24 (255.255.255.0) subnet, one machine gets 172.31.4.10, the other gets 172.31.4.20). That's less confusing and less likely to clash with your normal LAN infrastructure.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

bluestarfish
Posts: 7
Joined: Thu Jan 09, 2014 4:23 am

Re: Connecting two Pi's via Ethernet

Mon Aug 10, 2015 10:22 pm

Hi,

Sorry for being quiet but I am in Australia so sleep was calling. As the two Pi's are connected to each other I don't have a connection to ssh into them (I don't have a wireless dongle) otherwise it would be relatively easy to fault find, the fact is once I set them up I am locked out as I don't have a connection to SSH and when I put them back on the network they are on the wrong connection so I can't talk to them so it is a real pain trying to work out what is going on.

Anyway I am at work where I do have a HDMI monitor so will try and fault find from here. Note that unlike another previous post I am not trying to bridge them to another computer so I think the port forwarding stuff is not what I need but happy to be corrected. Also I don't think from reading I need to do master / save as again I am not bridging to another network nor creating a true network just a one to one connection.

Will let you know how I go.


Scott.

drgeoff
Posts: 10765
Joined: Wed Jan 25, 2012 6:39 pm

Re: Connecting two Pi's via Ethernet

Mon Aug 10, 2015 11:05 pm

Even though the two RPis are on a different logical subnet you can plug them into the same physical router and/or switch that the rest of your network is using. You can then change the IP address of your computer to put it on the same subnet as the two RPis. The PC can then ssh into the RPis for debugging purposes.

When you have the two RPis communicating to your satisfaction you can join them directly with an ethernet cable.

bluestarfish
Posts: 7
Joined: Thu Jan 09, 2014 4:23 am

Re: Connecting two Pi's via Ethernet

Mon Aug 10, 2015 11:49 pm

Hi,

Just to let you know that it is working... there was actually nothing wrong with the set up I had but it took some time to find the new route from one to another so Joan was probably right in that using a network it already knew about meant that it took some time (as in 10 minutes) for it to find the new route and if I had used another network then it should have worked from the go.

So for future you just need to set the addresses as being on the same network and the net mask and it should eventually see each other but this could take some time, clearing the network info would of course help as well.

Anyway all solved so thanks!


Scott.

Return to “Troubleshooting”