I want to make a cluster computer out of Raspberry Pis (with a network switch/hub, and mpiexec), and have run into the issue about how they will get internet access. Since it would be a hassle for all of them to have their own adapters and cables, I want to know if I can just put a wlan connection into the switch, or if it is more complex. If it is more complex, I was thinking that one of these computers could get internet access through this wifi adapter, and then share the connection to the rest of them. I saw this, but I want to get Kali 2.0 on these Pis, and still want to use mpiexec among all of them, and the accepted answer says the computers getting the internet won't be able to see the providers IP address without doing some DHCP server stuff.

So, how would I manage to get computers connected to the same network switch/hub internet access?

  • @roaima Alright, will do.
    – Flare Cat
    Jan 9, 2016 at 20:17
  • Ok, @roaima I edited it.
    – Flare Cat
    Jan 9, 2016 at 20:21

2 Answers 2


Are you wanting all of the Raspberry Pi devices to be accessible from the internet, for example to run a web server cluster? Or are you just trying to be able to have the Raspberry Pi devices access the internet from behind a firewall?

If you are just trying to give them access from behind a firewall then, just use a router instead of a switch. You would plug the internet connection into the WAN port on the router, and all of the raspberry pi devices would connect to the LAN port on the router. If there are not enough LAN ports on the router than you can make the local area network bigger with switches. Here is a picture of a typical LAN configuration:

LAN Setup

Most routers these days will handle DNS and DHCP for your local network, and generally also include some sort of NAT firewall. This will allow all of your raspberry pi devices to connect to the internet while preventing them from being accessed directly from the internet.

On the other hand if you WANT the Raspberry Pi devices to all be publicly addressable from the internet (e.g. to run websites on the cluster), then your setup is a little more complicated, and there are a couple of approaches you could take.

The first is to put the Raspberry Pi cluster into a DMZ that is separate from both the LAN and the WAN. Note however that you only have one publicly routable IP address with this setup so the cluster will need to be configured accordingly. The publicly routable IP address will be your WAN address, and you need to configure your WAN firewall / router to forward requests to the ports of interest to the machines of interest in the DMZ. Incoming response packets would be handled by NAT and redirected to the LAN or the DMZ depending on which local machine requested the resource. Here is a picture of a DMZ configuration.

DMZ Configuration

The other approach is to give each Raspberry Pi device a separate routable public IP address. This will also be the most expensive option since you will need to obtain these IP addresses from your Internet Service Provider. They will either run you separate lines for each IP address, or they will run you a single line (or fiber) and you will have to use a router and switches to break out that one line into many for your local WAN segment. The details will vary by ISP, how much bandwidth you require, and how many IP addresses you need.

  • This will work, but I wanted to stay away from routers, because I don't need wireless. Wireless opens up a whole new security issue, that I don't find with a wired connection. I'll have to see if I can disable the wireless on the router I'll get.
    – Flare Cat
    Jan 9, 2016 at 22:47
  • There are routers that do not have WIFI. Also, most wireless routers I have seen include an option to disable the WIFI. Also, I highly recommend looking for a router that is supported by DD-WRT, or OpenWRT. OpenWRT and it's derivatives are Open Source, Linux based router firmware distributions. They provide much more functionality and flexibility than the commercial firmware that comes on the routers. In fact many of the higher end consumer grade routers these days are shipping with customized versions of DD-WRT already on them. Jan 9, 2016 at 23:47
  • I read about DD-WRT in a post, and it looked great! I noticed you can turn off WPS, a major security flaw, with it. Can you turn off Wi-Fi with it, though? @user2121874 (sorry I posted username at the end, for some reason it wasn't showing up when I put it in the beginning.)
    – Flare Cat
    Jan 10, 2016 at 2:09
  • 1
    Yes, you can disable the WIFI with DD-WRT. Jan 10, 2016 at 3:29

You don't state it, but you probably have a router or something similar that provides Internet access. Let's call it a router. So the problem then comes down to getting all your Pis to talk to that router. You can do this either with cables or with WiFi.

If your Pis don't come with WiFi adapters then you could use the one you've suggested.

I don't see why you would want to use one of the Pis to share an Internet connection.

If you don't have a router or other device, and instead you have to run PPP on a single computer it does get a little more complicated. But you haven't explained how you would connect a single computer to the Internet.

  • I would connect the one pi using the wifi adapter I gave a link to.
    – Flare Cat
    Jan 9, 2016 at 22:18
  • To what would you connect it?
    – roaima
    Jan 9, 2016 at 23:26
  • The USB port on the pi, and I would connect to my home router.
    – Flare Cat
    Jan 10, 2016 at 2:07

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.