2 added 341 characters in body
source | link

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 WANTWANT the Raspberry Pi devices to all be publicly addressablepublicly 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.

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. 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.

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.

1
source | link

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. 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.