I currently have a raspberry pi4B (p0) with four raspberry pi Zeros (p1-4) all conected to the pi0 via USB (using usb gadget mode for a network connection). To be specific i'm using a pi Cluster Hat.

At the moment the p0 has an IP on my home network of p1-4 have IPs of

Accessing p1-4 from p0 via the network using their IPs works perfectly. However if I want to access p1-4 from another desktop computer desk then they don't show on the home network. From what I've read this makes sense, as the 172.19.181.x part of the IP of the p1-4 defines a new sub net that can't be accessed from outside.

My mental image of how these interconnect is this (not sure if correct):


My question is: is there a way that I can have desk communicate directly with p1-4? is the whole p0 and p1-4 system considered it's own sub network even though there is no seperate router between?

Also, how do the raspberry pis all behave if I remove them from the router's network? Right now the router assigns the p0 an IP of which p1-4 use in order to communicate with it, whereas the p1-4 always have their IP's the same ( For now I want to have all the pis on the home network for development, but will eventually want to remove the pi's (0-4) from the network and still have them be able to communicate without worrying about p0 having it's IP reassigned. Is this possible?

  • Also, I'm new to both raspberry pi and networking, go easy! Dec 24, 2020 at 14:52
  • 1
    Maybe you can configure a network "bridge" so you share the connection of p0 transparently such that each p1-4 receives a ip-address of it's own. Dec 24, 2020 at 15:06
  • @participant ace, cheers. I'll have a look ar bridging. Dec 24, 2020 at 15:43
  • Don't take to much effort to look for a bridge. As far as I know it isn't possible to add a tethered USB interface to a bridge.
    – Ingo
    Dec 25, 2020 at 16:24

2 Answers 2


This is a usual routing problem as used all over the world on the internet. You have two subnets, and (the bitmasks /24 are assumed. They are mostly used). All router on your network have to know to which next hop it has to send packages, to get to the destination subnet. The router must know that it has to send packages with destination to p0, its next hop. So you have to set a static route on the router. I don't know your router, so I can't say how to do it. Have a look at its configuration options. You must set a static route with destination network to (or netmask and its corresponding gateway (next hop) to, the ip address of p0. On a Linux system this would be set with:

router ~$ sudo ip route add via

Because p0 is working as (another) router now to the subnet, it is a bad idea that it has a dynamic ip address. If its ip address is changed by the DHCP server then you have to reconfigure all static routes to it on the network. So it is strongly recommended to give it a static ip address. Be sure that this ip address is not in the ip address pool of the DHCP server that it will give dynamically to devices on the network. As default gateway set the ip address of router. You also have to enable ip forwarding, so packages from subnet are forwarded to subnet This is done with:

rpi ~$ echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward

But this is only transient. On reboot it is lost. Look at your operating system how to set it persistent. On a RaspiOS you uncomment #net.ipv4.ip_forward=1 in /etc/sysctl.conf.

A static ip address also answers your second question. You can disconnect p0 from the network without loosing connection to pi1-4.


the "router" in your image is most likely a switch. It may be a switching part of an Internet router but it is (probably) still a switch.

I have never used a clusterhat, but as I understand it, there are two ways of configuring the network:

  • CNAT, use a separate subnet for the cluster, but nodes are not visible from the outside
  • CBRIDGE, all nodes are visible from the network.

As I understand it, these are different images for the nodes.

It is possible to set-up IPtable rules on the cluster controller if you use CNAT images. This will require a bit of tweaking. Also, you will probably need to set-up a static route on your desktop. If you've never done this, you should probable use CBRIDGE images.

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.