How should I connect 7 devices to a switch module with four ethernet interfaces? Is there a preferred topology?
Solution 1:
The thing to keep in mind is that the link between the switch and the router is shared between all devices trying to communicate across the link.
If:
- the devices predominantly connect to the internet and not to each other
- and the speed of the internet connection is slower than a single router port
then there is no networking difference between the 2 options, except that 5 port switches are very mildly cheaper than 8 port ones, and if the switch dies then the devices connected directly to the router will continue to have internet access.
However, if you are streaming data from one device to another within your network then the link between the switch and the router can be a bottleneck if 2 devices on the switch want to access 2 devices on the router at the same time and use more than half of the link bandwidth between the router/switch each.
But, if most of the internal traffic is to a home nas box / media server, then it will typically be limited to a single port speed as well, and the bottleneck between switch and router won't matter so much.
Personally, I find that my house has devices scattered around the place, and it's not practical for me to plug everything in to the 1 switch unless I run wires everywhere. So having the top option provides 2 locations that can have devices plugged in, with only 1 cable running between locations.
Edit: Nevin Williams makes a good point, that option 2 has more ports total. Paraphrasing one of the points Damon is making, it's better to have more ports for future expansion or unforeseen circumstances requiring 1 more port than you buy. However both of those points would no longer apply if option 1 used an 8 port switch and you still used all of the ports on the router, leaving the spare ports on the switch.
Solution 2:
Unless you already have a 5-port switch lying around and are too poor to afford buying the 8-bit switch, the second alternative is certainly the better one, in general. There may be valid reasons for something different, but generally you sure want to connect all hosts to the switch.
I would however buy a 16-port switch, since in my experience whenever you need 8 ports and have a switch with exactly 8 ports, you need 9 ports a week later. You never need more than 9 or 10 ports, however, if you bought a 16-port switch right away.
Internet routers are often on the cheapish side, overall and in respect to their switching capabilities as well as in respect of overall reliability, and with a firmware where it's hard to tell, or control, what exactly is going on.
Switches (except maybe the cheapest crap) are usually devices which never fail and where you know exactly what's going on at all times. Reliably, and reproduceably. I've only ever replaced switches when I needed more ports. I've never seen a switch crash, or take longer than 2 seconds to "boot". Wish I could say the same about routers.
Having all devices connect to one switch (assuming a no-shit switch with sufficient switching bandwidth) means each device is an equal among equals. Each device can talk full-duplex with each other device at all times, as if they were directly connected. Also, each device can talk with the router, sharing the single connection fairly (or unfairly, if you explicitly configure a smart switch to do something different, which has its uses!).
Normally, sharing bandwidth to the router is no problem at all since very few people have internet connections exceeding the speed of 1GbE, so either way the internet link is slower than the shared connection.
On the other hand, plugging several network cables into the router/switch may very well increase its power consumption (and heat development, respectively reducing reliability and lifetime) by 20-30% (that's the case with my AVM router here), and depending on details that you cannot verify or control maybe CPU load as well, which might possibly reduce throughput.
The router might very well be unfair (unintentionally, due to a lacking firmware) towards clients sharing one connection via a switch in comparison to those connected directly. Hopefully that isn't the case, but you have no way of being sure. It might allow 4 cables being plugged in, but only have switching capacity for 2 of them full-duplex. Not rarely, a router will also serve as wireless access point, too. Is that bridged in hardware or software? Does that count against the switching capacity or not? Usually you don't know.
None of those "don't know, can't tell" things apply if every host connects to the switch. There is exactly one cable going into the router, which is as good as it gets. You still have to live with what you don't know about the router, but you are in control of what you can control.
Routes are only unfair if you explicitly configure the switch (if it's capable of that) to behave that way. This is for example useful if you run something like DownloadStation on a NAS and wish to use the full capacity of your internet connection, but at the same time you do not want your desktop computer to have a noticeable impact or being virtually "devoid of internet" because the download task steals all the bandwidth. Or, if you do not like your smart TV being too smart, and wish to removing those stupid HbbTV ads blocking out a third of your screen, just tell the router not to forward port 80 to that host. Or something. Don't allow some cheapish IoT thingie which might get hijacked to attack your desktop computer from a local address, possibly bypassing the firewall (but let the desktop connect to the device).
Sure, some routers can do these kind of things as well, but it's all rather on the cheapish side, usually limited, and with often moderately satisfying results.
It is also a much more elegant design overall. Every host has exactly the same number of hops to each local and remote location, every host's connectivity can be controlled in one central place, and there is exactly one cable to check in case of "meh, internet no work", or one cable to pull out in case you want to cut the line the hard way.
Solution 3:
Adding my $0.02, since it isn't covered directly in the other answers:
Bandwidth and power calculations aside, I would purchase an 8 port switch and go with the 2nd topology since your network may expand in the future. In fact, I would consider buying an even larger switch if you can find one at a similar price point. I recently set up a small network very similar to yours, and I was surprised at how quickly I filled up the extra ports that I thought I would never use.
One of the tenets of good network design is expandability, which I would definitely take into account while designing your network (no matter how small it is).
Solution 4:
In brief
It depends from your goal:
- To make savings or to have 2 or 3 privileged devices (and 4-5 of secondary importance, less privileged) you can opt for the first solution, even with an 8 port switch that you should to buy any way.
- Scalability and "democracy" (in privileges) suggests the second configuration.
- For robustness and resilience of your network you need Redundancy: a third solution.
Some words more
A review of your solutions:
-
Solution A: 3 on the 1st level + switch with 4 on the second level
- It may give to each of the first 3 devices the same bandwidth of the second whole block.
- The first 3 devices exchanging files among themselves may shrink the internet bandwidth for the second block.
- The second block can exchange files without shrinking the bandwidth of the first 3 ones.
-
Solution B: 7 together on the second level.
- No preference for any devices. (democracy).
- If two device exchange a lot between themselves, you may affect the bandwidth for the other 5 (there is a limit bandwidth for internal network too not only on the external side).
- 3 slot free on the router to scale the system (and buy other switches)
- 1 slot free on the second level to add a new spare device.
The Redundancy
- Sometimes thing goes wrong.
- If you wait enough time it can arrive that moment "Anything that can go wrong will go wrong."'.
- Be ready.
(... and probably that moment will never arrive! Paraphrasing again Murphy)
Redundancy. If you have no problem to buy 2 switches of 8 port each (BTW you will use more electricity) if one switch breaks you will have the possibility to connect all your devices on the other one and quickly restore the connection to internet and inside your home/work network.
-
Solution C: (2 switches of 8 port each).
- Resilience: if one switch breaks you can connect all your devices to the other one (solution B) meanwhile you buy the new one...
- The traffic will be more balanced in case one eager user (at least the other block can use half of the router bandwidth, or exchange at full bandwidth among themselves).
- Costs (-): Startup and maintenance costs: You need to buy 2 switches and keep them turned on.
- Independence. Traffic inside each of the 2 groups will not affect the traffic on the second one.
I liked your Schetch:
============
|| || ________
|| Router || | |--- Free x 5
|| 4-port || | 8-port |--------Device 1
|| Switch || | Switch |--------Device 2
|| || +-------------|________|--------Device 3
|| || |
||--------|| | ________
|| ||-----+ | |--------Device 4
|| 4-port ||-------------------| 8-port |--------Device 5
|| Switch ||-- Free | Switch |--------Device 6
|| ||-- Free | |--------Device 7
============ |________|--- Free x 4