How should I connect 7 devices to a switch module with four ethernet interfaces? Is there a preferred topology?
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.
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.
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).