Consider the following scenario where I have n number of RPis connected to a Ethernet switch in order to create a internal network. All these RPis have a static IP.

Now one of the RPi (call it a head node if you like) has a USB to Ethernet adapter which connects the head node to a router. I have other PCs connected to this router and I want to ssh to the nodes from that PCs.

RPi cluster network

All these RPis have Arch Linux ARM as OS.

How should I configure the network?

  • You want the other pi's to use as their default route and you want pi_0 to IP forward, NAT, and masquerade packets from (and to) them through to/from the router. – goldilocks Aug 28 '16 at 17:36
  • 1
    Let's assume the rpi network uses the subnet As long as the external network uses another subnet (e.g. it's sufficient to set the default route of all pi's to and define a static route in the router to the subnet via the IP the head node has in the subnet (e.g. All other pc's have the default route set to the router who then will route all requests to the rpi's to the head node which forwards the request. – framp Aug 28 '16 at 20:25
  • Follow this. Assume that the internal network is the LAN and your main network is the WAN. – PNDA Aug 29 '16 at 3:12
  • Pi_0 as a simple router is sufficient and there is no natting and masquerading required. It will work also this way but introduces additional configuration complexity and requires additional iptables definitions to be able to initiate network connections to the natted devices. – framp Aug 30 '16 at 20:34

Assuming pi_0 has IP on the external network and www is the connection to the internet.

Just enable routing (add net.ipv4.ip_forward=1 in /etc/sysctl.conf) on pi_0, define a static route on the router to the pi_n subnet (route add -net gw and set the default gateway to pi_0 on all pi_n (route add default gw eth1 ).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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