0

Is it possible to daisy chain the ethernet connection between pi's

Internet/ethernet in to pi #1 then share this internet connection with pi #2 via usb to ethernet adapter? or otherwise?

3
  • Certainly possible, it's called routing. What OS do your RPi's have? Do you want to avoid investing in a switch? Commented Mar 7, 2018 at 8:28
  • WiFi-accesspoint might be an option as well... Commented Mar 7, 2018 at 11:28
  • im on raspbian 9, yeah want try without a switch if possible...
    – Matt
    Commented Mar 8, 2018 at 11:01

2 Answers 2

1

Yes, it is possible. You can enable ip forwarding on every raspi so all of them work as router. But then you have to setup different networks for every ethernet connection so you can route packets between the networks, e.g.

rpiA[eth1:192.168.0.1/24] -> rpiB[eth0:192.168.0.2/24 # eth1:192.168.1.1/24] -> rpiC[eth0:192.168.1.2/24]

You can fiddle with the netmask to reduce the size of the different networks.

Better is to use a bridge on every raspi so all of them have the same broadcast domain.

3
  • Maybe useful to show how to configure RPi in bridge mode, and a few words on any limitations that result from operating in that mode?
    – Seamus
    Commented Jan 8, 2020 at 22:14
  • @Seamus The question is nearly two years old now and to vague and without any feedback from the OP. I'm not very motivated to invest more effort ... If you like just edit the answer.
    – Ingo
    Commented Jan 8, 2020 at 22:39
  • Understood... I voted for yr answer, but didn't notice the age. But not to worry, I won't take my vote away :) But seriously, it's an odd question. I thought it might be about saving the cost of an E'net switch.
    – Seamus
    Commented Jan 8, 2020 at 22:54
0

Assuming your internet conection is with the WiFi interface Assuming you're running a good distro for the Pi like Ubuntu 16.04 or Raspbian.

You can install a firewall like [preferred] Shorewall Firewall. It uses configuration files that are then compiled and a set of iptables commands are created and inserted into a bash script that runs the firewall with masquerading. This way your internal LAN network masquerades behind your external WAN WiFi interface.

I have a basic configuration that uses (4) files: - policy - the basic policy of the firewall, - rules - the rules you create for in/out trafffic, - interfaces - the external interface [WAN], - zones - the zones of the firewall. See https://shorewall.org/

Here are my configuration files for my firewall/router, a Pi 3 B:

rpi3b as the HOMENET firewall and router

Network hardware Configuration

  • eth0 as the external interface. On-board eth interface.
  • eth1 as the local 10.0.100.240/28 interface. USB/eth dongle #3.
  • eth2 as the local 10.0.200.240/28 interface. USB/eth dongle #4.
  • USB layout: [ 1 ][ 2 ] [ 3 ][ 4 ]

Operating System

  • Ubuntu Mate 16.04.

Firewall

  • Shorewall firewall v5.0.4.

Firewall configurataion

/etc/shorewall/policy

#

SOURCE DEST POLICY LOG LIMIT: CONNLIMIT:

$FW net ACCEPT net all DROP NFLOG

The FOLLOWING POLICY MUST BE LAST

all all REJECT NFLOG

#END

/etc/shorewall/rules

#

ACTION SOURCE DEST PROTO

Ping(DROP) net $FW DNS(ACCEPT) $FW net SSH(ACCEPT) loc $FW ACCEPT $FW net icmp

Remote ssh access from the net to internal system ix

DNAT net fw:10.0.100.241:22 tcp 11701

#END

/etc/shorewall/zones

ZONE TYPE

# fw firewall net ipv4 loc ipv4

#END

/etc/shorewall/interfaces

#

ZONE INTERFACE BROADCAST OPTIONS

net detect dhcp,tcpflags,logmartians # external loc detect tcpflags,logmartians # internal 100 subnet loc detect tcpflags,logmartians # internal 200 subnet

#END

/etc/shorewall/masq

#

INTERFACE:DEST SOURCE ADDRESS

10.0.100.240/28,10.0.200.240/28

#END

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.