dan3008
Posts: 1172
Joined: Wed Aug 15, 2012 1:05 pm

2 pi's 1 ethernet wire?

Thu May 22, 2014 8:23 pm

So, I want to connect my 2 pi's to the internet (ones an email server the others a blog server), So now i'm designing a case, and was hoping to keep wires down. I've already integrated a powered usb hub, make only 1 power line, now i'm looking to make only 1 ethernet cable. I've looked at using a splitter, but that would still take 2 ports on my router. So i'm looking for a more effective way to achieve this shared connection?

I've considered including a hub in the case, but that would make it too big for the self. unless someone knows of a tiny (preferably passive or usb powered) 2 port hub?

thanks

dan
dan3008 wrote:Pays your money, takes your choice

HiroProtagonist
Posts: 212
Joined: Sat Jun 29, 2013 9:45 am

Re: 2 pi's 1 ethernet wire?

Thu May 22, 2014 10:12 pm

dan3008 wrote:So, I want to connect my 2 pi's to the internet (ones an email server the others a blog server), So now i'm designing a case, and was hoping to keep wires down. I've already integrated a powered usb hub, make only 1 power line, now i'm looking to make only 1 ethernet cable. I've looked at using a splitter, but that would still take 2 ports on my router. So i'm looking for a more effective way to achieve this shared connection?

I've considered including a hub in the case, but that would make it too big for the self. unless someone knows of a tiny (preferably passive or usb powered) 2 port hub?
Define "effective".

I'd go for the splitter, but if you don't have 2 ports on your router, the simplest option would be to connect the ethernet to one pi, add a usb to ethernet adapter connected with a short crossover to the 2nd pi & route from pi #1 to pi# 2. If one of the Pi's will have a heavier network load, make that the directly connected one.

Off the top of my head you'll need to:
Manually configure the IP addresses of both Pi's [no DHCP]
Add a host route to Pi #2 on Pi #1 via the usb to ethernet device.
Add a default route to Pi #2 using Pi #1 as the gateway.

At this point you should be able to ping between the two devices.

Enable IP forwarding on Pi #1 [ sudo echo 1 > /proc/sys/net/ipv4/ip_forward ].
Add a static route for Pi #2 to your router with Pi #1 as the gateway.

At this point you should be able to ping Pi #2 from another device on your network.

User avatar
DougieLawson
Posts: 36571
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: 2 pi's 1 ethernet wire?

Thu May 22, 2014 10:53 pm

If you assign static addresses on both ends, you can simply connect a stock cat5 cable from one pi to the other. It's easiest doing that in /etc/network/interfaces as that gets the routing table set-up automagically.

Make sure the point-to-point addresses are in a different address block to the addresses assigned by DHCP for your WiFi interfaces.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

plugwash
Forum Moderator
Forum Moderator
Posts: 3476
Joined: Wed Dec 28, 2011 11:45 pm

Re: 2 pi's 1 ethernet wire?

Thu May 22, 2014 10:55 pm

If you want to go down the one Pi has two ethernet adaptors rout ethernet bridging is probablly an easier soloution than IP routing.

How much space do we have to work with? Would something like https://www.blackbox.co.uk/gb-gb/si/150 ... h/V1.S1.O4 work for you?

dan3008
Posts: 1172
Joined: Wed Aug 15, 2012 1:05 pm

Re: 2 pi's 1 ethernet wire?

Fri May 23, 2014 6:28 am

Thanks for all the constructive feedback :) Really appreciated.
plugwash wrote: How much space do we have to work with? Would something like https://www.blackbox.co.uk/gb-gb/si/150 ... h/V1.S1.O4 work for you?
I've not actually built the case yet, so im quite flexable, however, youre link (followed by google) lead me to this so i'll take a look at the options there. thanks a million
dan3008 wrote:Pays your money, takes your choice

gdt
Posts: 85
Joined: Thu Jul 19, 2012 10:19 am

Re: 2 pi's 1 ethernet wire?

Mon May 26, 2014 12:46 pm

I'd suggest locating a four-port fast ethernet switch with the "auto MDI" feature and a plugpack. Strip the packaging and you should get something you can mount inside a box. You'll need to crimp your own Cat5 ethernet cables as the shortest pre-assembled cables are 1ft/0.5m.

Note that ethernet is a power-hungry bus (it's designed to drive 100m of copper) and the draw from the switch will be considerable when compared to the Pi.

That makes the suggestion of driving one Pi using ethernet can interconnecting the Pi's using a host-host USB cable assembly attractive. At least from a power point of view. From a throughput point of view remember that the Pi has one internal USB bus which hosts both USB ports and the fast ethernet port. Sending all traffic through that twice will lead to disappointing throughput, if you care for throughput at all.

Another option again is to interconnect the serial connectors on the Pis and run PPP over that to establish a 0.1Mbps link, which might be sufficient for your needs.

ame
Posts: 3172
Joined: Sat Aug 18, 2012 1:21 am
Location: Korea

Re: 2 pi's 1 ethernet wire?

Mon May 26, 2014 12:52 pm

Insert a USB wifi dongle in each of the two Pis. No wire necessary.

oystercatcher
Posts: 8
Joined: Wed Nov 16, 2011 10:32 am

Re: 2 pi's 1 ethernet wire?

Thu May 29, 2014 12:26 am

my preference when the router doesn't have sufficient ethernet ports available is to buy a powered
ethernet hub. plug it into the router and you will have as many ports available as are on the hub.

also the earlier suggestion of using wifi if your router has that capability.

not sure why you wouldn't just put the two rpi servers adjacent to the router assuming you have
enough power jacks and ports? otherwise you can have long runs of ethernet terminating in small
ethernet hubs if you have a room with lots of devices remote from the router.

User avatar
DougieLawson
Posts: 36571
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: 2 pi's 1 ethernet wire?

Thu May 29, 2014 7:38 am

oystercatcher wrote:my preference when the router doesn't have sufficient ethernet ports available is to buy a powered
ethernet hub. plug it into the router and you will have as many ports available as are on the hub.
Easier is a small (powered) ethernet switch.
http://www.broadbandbuyer.co.uk/Shop/Sh ... uctID=9673
The existing cable goes in one port and you get four ports for your laptop, your RPi and two other devices.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

cil8
Posts: 179
Joined: Tue Feb 14, 2012 10:47 am

Re: 2 pi's 1 ethernet wire?

Thu May 29, 2014 10:58 am

This isn't exactly an aswer to your question, but... Are you sure that just one pi couldn't act as blog server AND mail server?

My 2c.

Ciao

dan3008
Posts: 1172
Joined: Wed Aug 15, 2012 1:05 pm

Re: 2 pi's 1 ethernet wire?

Sat May 31, 2014 1:05 pm

ame wrote:Insert a USB wifi dongle in each of the two Pis. No wire necessary.
Tried that one, the speed is terrible. ok for email, but my blogs are hediously slow to load, even from the same network
cil8 wrote:This isn't exactly an aswer to your question, but... Are you sure that just one pi couldn't act as blog server AND mail server?

My 2c.

Ciao
thats my next challange. to see if 1 pi is enough, if so, I'll redesign my case, and can use that instead. Probably will be, since i've recently upgraded to a new model b (I had the original 256mb before, now got a new one.)

thanks again for the feedback :)
dan3008 wrote:Pays your money, takes your choice

Return to “Networking and servers”